
Signature
Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
>> I have a Java app, running on Windows, with a medium amount
>> of C++ wrapper code doing various arcane and boring things.
[quoted text clipped - 10 lines]
>doesn't try very hard until the used memory gets to be very close to
>"full" for the currently allocated heap size.
I'm aware of that, but there may be some subtlties in the Java GC that
I'm missing. JProfiler claims that the heap never grows beyound about
10MB. I see regular garbage collections occurring which generally reduce
my consumption from about 9MB to about 6MB. I can run the system all day
and this won't change. However, Process Explorer insists that my app,
which started off using 30MB of private memory, is now using 60MB. Forcing
a GC via JProfiler doesn't do anything to change this.
Obviously using JProfiler is going change the system behavior and mess
with these numbers blah blah Heisenberg. I realize this is not an exact
science.
Alan

Signature
Defendit numerus
Mark Space - 26 Oct 2007 00:40 GMT
> and this won't change. However, Process Explorer insists that my app,
> which started off using 30MB of private memory, is now using 60MB. Forcing
[quoted text clipped - 3 lines]
> with these numbers blah blah Heisenberg. I realize this is not an exact
> science.
Roedy's link explains that not calling dispose() on GUI objects results
in the underlying (native) objects being retained by the OS. Could be
something like that. You may have to look beyond the JVM and see what
the rest of the system is allocating on your behalf.
I'm not an expert in Windows heap analysis by any means, but if you find
some good info debugging Windows heaps please post up what you find. :-)
Alan Morgan - 26 Oct 2007 01:24 GMT
>> and this won't change. However, Process Explorer insists that my app,
>> which started off using 30MB of private memory, is now using 60MB. Forcing
[quoted text clipped - 6 lines]
>Roedy's link explains that not calling dispose() on GUI objects results
>in the underlying (native) objects being retained by the OS.
Mmm. I'm not using GUI objects but the same principles could apply to
other objects. I'll see if Purity can give me any information there.
Alan

Signature
Defendit numerus
Robert Klemme - 26 Oct 2007 17:57 GMT
>>> and this won't change. However, Process Explorer insists that my app,
>>> which started off using 30MB of private memory, is now using 60MB. Forcing
[quoted text clipped - 8 lines]
> Mmm. I'm not using GUI objects but the same principles could apply to
> other objects. I'll see if Purity can give me any information there.
Did you run the JVM with verbose GC trace? Did it tell anything
interesting?
Btw, 60MB does not sound much nowadays. I believe the JVM's default for
-Xmx is 64MB so you could expect it to grow a bit more without having
to worry.
Kind regards
robert
David Gourley - 29 Oct 2007 23:05 GMT
> Mmm. I'm not using GUI objects but the same principles could apply to
> other objects. I'll see if Purity can give me any information there.
>
> Alan
You may also want to take a look at some of the IO classes with
associated close() methods... these objects often have (in some cases
significant) native memory associated with them. If you explicitly call
close() the native memory is freed; if you don't, the memory doesn't get
freed until the object finaliser gets called (which if the object has
been promoted to the old area may never happen). I've seen one deviant
case where we got OutOfMemory because of this even though there was
plenty of free memory in the Java heap.
You may be able to allay this particular problem by tweaking GC
parameters (if it's outside your code) - as you can cause objects to
live for longer without getting promoted if this is the problem.
However (IMO) best practice is always to call a close() or dispose()
method if it exists (preferably in a finally block...)
Dave
kohlerm - 26 Oct 2007 23:34 GMT
> In article <I_idnSdha7zskLzanZ2dnUVZ_hWdn...@wavecable.com>,
>
[quoted text clipped - 28 lines]
> --
> Defendit numerus
This looks like that the leak is not in Java.
To be sure the easiest way to find out whether it's a leak in Java is
to get
the SAP Memory Analyzer at https://www.sdn.sap.com/irj/sdn/wiki?path=/display/Java/Java+Memory+Analysis.
It's free and will be open sourced soon(check my blog here
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/7637)
Regards,
Markus