[jdom-interest] Re:JDOM and Garbage Collection

Xuemin Guan xuemin at appresso.com
Wed Sep 18 09:24:50 PDT 2002


Xiaozheng Ma wrote:
> At 00:09 2002-9-18 -0600, you wrote:
> 
>> JDOM and Garbage Collection (PJ.Fanning at polarlake.com)
> 
> 
>  >I have an application that uses a mix of reusable components, some 
> written
>  >in SAX and some in JDOM. I have noticed that there is a significant 
> memory
>  >leak and I suspect that once I have finished with a JDOM Document, 
> that the
>  >Garbage Collector is not reclaiming all the available memory. JProbe 
> seems
>  >to back up this assertion.
>  >I am thinking of going recursively through each JDOM Document when I 
> finish
>  >with it and setting the content at each level to null.
>  >Has anyone come across a similar problem or have any thoughts on what I
>  >should do?
> 
> Since JDOM is written in Java, I'm wondering what do you mean "memory 
> leak" if your assertion is correct. Java gc should be able to collect 
> memory garbage  after you force each used reference to null. Please try 
> call
> 
> System.gc();
> 



Apparently, the user doesn't think he has the
control in doing so, and believes the problem lays in the
third party package. Thinking that the Java garbage collector
can do everything for you is a big misunderstanding. It only
collects the objects which are nulled on time.

 >Please try call

>System.gc();

If there is a memory leak, System.gc() is unlikely to help. It
is only a request to the JVM. But doesn't necessary do so immediately,
and also won't help if there are objects not derefenced.


-- 
Xuemin Guan



-- 
Xuemin Guan

Email: metaphor at aa.bb-east.ne.jp
Mobil: +81-90-6165-7793
Tokyo Japan




More information about the jdom-interest mailing list