[jdom-interest] JDOM output buffering question

Gamble, Wesley (WG10) WG10 at tmw.com
Mon Jan 21 12:23:58 PST 2008


Rolf,

Thanks for this.  I may not have a problem at all.  I've been away from
the Java world for the while.  Not sure if I was always unaware of this
or just forgot it.  Will check with the verbose gc display to determine
what's happening.

Thanks,
Wes

-----Original Message-----
From: Rolf Lear [mailto:jdom at tuis.net] 
Sent: Monday, January 21, 2008 1:14 PM
To: Gamble, Wesley (WG10)
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] JDOM output buffering question

JVM's are typically reluctant to release memory back to the OS. A better

way to monitor the actual memory usage (in your case) is to turn on the 
-verbose:gc commandline-option (or better, the -verbose:gc 
-XX:PrintGCTimeStamps) to your Java process. This will track your memory

usage better, and tell you how much memory gets cleaned up from 
no-longer-referenced Java classes (Garbage Collected).

May I suggest the following reading material:
http://java.sun.com/j2se/reference/whitepapers/memorymanagement_whitepap
er.pdf

Once Java requests memory from the OS, it is very unlikely to give it 
back. Whether it gets used (again) or not. Tracking memory from the OS 
perspective gives you no indication as to whether objects are GC's or
not.

Another Alternative is to generate a Full heap dump from your JVM (Press

Ctrl-ScrollLock in Windows, and Ctrl-\ on Unix (or kill-3 <pid>).

Rolf

Gamble, Wesley (WG10) wrote:
> I'm watching the memory for the Java process in the Windows task
> manager.
>
> -----Original Message-----
> From: Rolf Lear [mailto:jdom at tuis.net] 
> Sent: Tuesday, January 15, 2008 6:41 PM
> To: Gamble, Wesley (WG10)
> Cc: jdom-interest at jdom.org
> Subject: Re: [jdom-interest] JDOM output buffering question
>
> Gamble, Wesley (WG10) wrote:
>   
>> I put a finalize method on the object that holds the SAXBuilder as an

>> instance variable, and set the SAXBuilder to null, and no memory is 
>> released.
>>
>> The descendant of the JDOM Document gets garbage collected, and I'm 
>> assuming the SAXBuilder will get garbage collected, but my memory is 
>> still way high.
>>
>> Can anyone think of any ways that resources could still be held on to

>> in this scenario. Perhaps my leak is not in JDOM.
>>
>> Thanks,
>>
>> Wes
>>
>>
>>     
>
------------------------------------------------------------------------
>   
>> _______________________________________________
>> To control your jdom-interest membership:
>>
>>     
>
http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> How are you measuring your memory usage?
>
> Rolf
>
>   





More information about the jdom-interest mailing list