Re: Memory leak using Beanshell.

"David A. Lee" <[email protected]> Tue, 21 Oct 2008 08:56:39 -0400
Newsgroups gmane.comp.java.beanshell.user
Message-ID <[email protected]>
In my app I once had this problem.  I discovered some circular dependancies in my app which were causing beanshell to hold onto an instance of hte interpreter.   A critical point is that if any of the rules keep an instance to any class that in turn references the interpreter, it can consume memory in a way the GC doesnt detect.  To clean up from this, its important that you dont store multiple references to the interpreter, especially in any objects you create from BS scripts.  Or if you do, you need to break the cycle of referencs.  To discover these, I used a Java memory tool,
JProfiler .. and looked for where the interpreter references were being held.  Its important to clear ALL references to the interpreter when you release it or it may leak.   Once I fixed that up (no changes to BSH internals) it stopped leaking, and I can run for months without any increase in memory use, loading scripts over and over.


  ----- Original Message ----- 
  From: Atul Bisaria 
  To: beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org 
  Sent: Tuesday, October 21, 2008 8:38 AM
  Subject: [Beanshell-users] Memory leak using Beanshell.


  Hi,

   

  I am using Beanshell version 1.2-b3. I am using it inside Jetty application server. Whenever I hot deploy the application, the Jetty server does not restart but the Beanshell loads the rules file in the application again. Repeatedly hot deploying the application is resulting in memory leak due to Beanshell (checked it from a Java profiling tool) and an OutOfMemory exception is thrown.

   

  Please let me know if there is a fix or a patch available to resolve memory leak in Beanshell?

   

  Thanks and Regards,

  Atul Bisaria

  Senior Associate

  O: +91 95120 4075267 | M: +91 9818611147

  Headstrong Services, D-4, Sector 59, Noida, India. 

   

   



------------------------------------------------------------------------------


  -------------------------------------------------------------------------
  This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
  Build the coolest Linux based applications with Moblin SDK & win great prizes
  Grand prize is a trip for two to an Open Source event anywhere in the world
  http://moblin-contest.org/redirect.php?banner_id=100&url=/


------------------------------------------------------------------------------


  _______________________________________________
  Beanshell-users mailing list
  Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
  https://lists.sourceforge.net/lists/listinfo/beanshell-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
Beanshell-users mailing list
Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/beanshell-users