How to resolve out of memory error Java heap space | Community
Skip to main content
Level 3
January 2, 2019

How to resolve out of memory error Java heap space

  • January 2, 2019
  • 2 replies
  • 38226 views

Hello All,

             We have implemented java sling servlet rest API for AEM 6.4 version. We are facing  out of memory error at regular time interval and server hanging.

Can someone help how to resolve it ? or is it due java sling servlet implementation or due to some server configuration issue.

Thanks

Qamar

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Adobe Employee
January 2, 2019

Increase heap size first. Use correct memory parameters[1] either with jar or <crx-quickstart folder>/bin/start script when starting AEM instance.

Check your servlet/custom code for any possible memory leaks.

Thanks,

Wasil

[1] Increase java heap size – /home/edivad

Level 3
January 2, 2019

Thanks Wasil for  quick reply,

1.Increase heap size first [I have done this]

After posting this I have found below solution and I have done this also just one question,Is warnings also reason of it?

2. Check your servlet/custom code for any possible memory leaks [I have done this]

I will try this and update you result

3.Use correct memory parameters[1] either with jar or <crx-quickstart folder>/bin/start script

Thanks

Qamar

Adobe Employee
January 2, 2019

Yes, warning in the logs - might be the reason. Analyse the logs carefully.

raj_mandalapu
Level 7
January 8, 2019

Hi Qamar, Performance issue is not a simple thing and it depends on multiple factors.

1. What could be ideal size heap memory for AEM6.4

   It depends on mulitple factors.

  1.      Total how many users are going to hit your server?
  2.      How frequently you are updating content?
  3. What is the DAM content size?
  • etc.

2.Second what can causing this server slow running behavior in our case

When you upload Assets, internally the workflows will trigger, request you disable and try once. What is the size of Assets you are uploading? Please double check your code on closing resourceResolvers properly? is it happening on bulk upload or only for a single asset? How many users are parallelly accessing your server at a time?

You can download thread dumps and check where the problem is?

Level 2
September 14, 2023

Hey you can increase your java heap size using this command just update your jar name.

java -Xmx1024m -jar aem-jar-name.jar