Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

possible ways to happen memory leaks while using jsp and servlets in development mode

can any one please explain possible ways to happen memory leaks while using jsp and servlets in development mode?

getting pergemn space exception after started using jsp&servlets .

eclipse.ini memory spec i given :

-Xms1024m
-Xmx1024m
-XX:MaxNewSize=448m 
-XX:NewSize=448m 
like image 429
Suresh Atta Avatar asked Dec 21 '25 02:12

Suresh Atta


1 Answers

Here are few comments/suggestions on this.

  1. You are getting permgen space exception. To understand this error, you need a bit of understanding of Java memory model and how the pergen space is used. Check out this link for a brief overview on this.
  2. Basically is region in the heap-space where the object allocated are never reclaimed by garbage collector. There are specific object types are allocated on this region (e.g. Classloaders, Literal pool etc.)
  3. Pergen space to be used by JVM can be specified at start up. If you don't specify, it will take some default value.
  4. It would be a good idea to memory-profile your application. Memory profiling gives a good insight into the actual heap usage. You can check the type and the number of objects being created and then trace them to your code which is doing this.
  5. There are lot of commercial and opensource profiling tools available. You can try some of them. There is VisualVM which comes bundled with JDK.
  6. Lastly, setting up appropriate memory settings for JVM is always tuning exercise. Its not about one size fitting all :) and profiling is very vital is tuning your application.
like image 78
Santosh Avatar answered Dec 22 '25 17:12

Santosh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!