javaee / javahelp

javahelp
Other
14 stars 15 forks source link

Java Help 2_0_05 Memory Leak in FlatMap #32

Open glassfishrobot opened 13 years ago

glassfishrobot commented 13 years ago

We have a Java Desktop Application which uses JavaHelp library to show Help Content.

From "Main Java Window", we launch another "JFrame Window". The later "JFrame Window" can be closed and opened several times when "Main Java Window" is still alive.

"JFrame Window" used JavaHelp and creates HelpSet etc. When we close the "JFrame Window" we call cleanup method on HelpSet and HelpBroker object and assign the object=null.

Note that we have large number of help html files. But it is observed that JavaHelp's FlatMap object is not getting released for after closing "JFrame Window" (Even after running GC). "FlatMap" has "FlatMapResourceBundle" inner class which has got "lookup" hashtable. This "lookup" hashtable is storing big chunk of memory.

I've written the sample example to re-create the issue.

Request you to follow below instructions.

1) Download attached sample zip file. Extract it. This has doc, lib, src directory. 2) Download http://download.java.net/javadesktop/javahelp/javahelp2_0_05.zip and put "jhall.jar" in lib directory. 3) You need large number of html files. We use Java Help Documentation Goto http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html#docs Navigate to the "J2SE 5.0 Documentation" on the same page and click "download" to download "jdk-1_5_0-doc.zip" (Follow the page to download as instructed). 4) Just extract above download documentation into "doc" directory. 5) The sample program is very very generic as it generates helpset, map files too.

CD to "src" directory and compile and run the sample as shown below.

Compile javac -classpath ..\lib\jhall.jar com\org\test\memory\TestJavaHelpMem.java

Run java -classpath .;..\lib\jhall.jar com.org.test.memory.TestJavaHelpMem "..\doc"

Now what we need

We need a API (a cleanup function) to remove the memory chunk held by FlatMap::FlatMapResourceBundle::lookup table. Also have a look at cleanup the memory reference around it.

Environment

Windows 2003 Professional, Java Help 2_0_05, Java version "1.6.0_25"

Affected Versions

[current]

glassfishrobot commented 13 years ago

Reported by raghuveer.talekar

glassfishrobot commented 13 years ago

File: JavaHelp_Memor_Leak_Posting.zip Attached By: raghuveer.talekar

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAVAHELP-32