FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory

Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
Opensearch version - v2.2.0

Describe the issue:
Opensearch dashboard pod got restarted with following fatal error

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory

How we can increase the java heap memory. We couldn’t find an option to set it up.

opensearch-dashboards@observability-opensearch-dashboards-67db5bf955-8h6rv:~$ env|grep -i java
opensearch-dashboards@observability-opensearch-dashboards-67db5bf955-8h6rv:~$

Could you please suggest how to increase and verify the java heap memory on dashboard.

Thanks,
Kishore

@kksaha I never had such an error in OpenSearch Dashboards.
What resources did you assign to the OpenSearch Dashboards pod? Did you use helm charts?

Thanks @pablo for your response.Yes, we are using helm chart with following resource limit.

  resources:
    requests:
      cpu: "100m"
      memory: "512M"
    limits:
      cpu: "4"
      memory: "8Gi"

@pablo Please follow here FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory · Issue #4657 · opensearch-project/OpenSearch-Dashboards · GitHub

@kksaha Thanks for sharing the link. Did you try that solution?

@pablo Sorry for delay in response, yesI tried and it worked.