bugKawa - Bugs: bug #24041, memory leak when using disposable...

 
 

bug #24041: memory leak when using disposable class loaders

Submitter:  Jean-Philippe Gariepy <gawi>
Submitted:  Mon 11 Aug 2008 07:40:58 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 11 Aug 2008 07:40:58 PM UTC, original submission:  

This problem arise when:
-kawa classes are loaded by a classloader different from the
system class loader (i.e. in a web app)
-and the classloader used to load kawa is disposed (like reloading an application in a web application container) in order to garbage collect the classes defined by it

This is a variation of something described here:
http://blogs.sun.com/fkieviet/entry/classloader_leaks_the_dreaded_java

Shutdown hooks registered by WriterManager are stored in a container loaded by the system class loader.  The hook keeps a reference to an instance of WriterManager.  In turn, the WriterManager instance keeps a reference to its class object, the class object keeps a reference to the classloader itself, making it impossible for the garbage collector to reclaim the class loader and to free the permanent generation space.

Shutdown hooks should only be added for "main" modules (runAsMain) or when running kawa.repl.main().

Current code is:

Scheme.java:

 public static final kawa.repl repl;
 ...
 static
 {
 ...
    repl = new kawa.repl(instance);
 ...
 }

repl.java:

 ...
 static boolean shutdownRegistered
    = gnu.text.WriterManager.instance.registerShutdownHook();
 ...
 

Jean-Philippe Gariepy <gawi>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gawi (Submitted the item)
  • -email is unavailable- added by gawi
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-08-11 gawi Carbon-Copy- Added gawi

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code