[ajug-members] Understanding Swing memory management
donald_bleyl at hotmail.com
Fri Jul 23 09:14:15 EDT 2004
>I run garbage collection manually
>and don't really see any massive reductions.
Implies there are still references to the old objects. Find the
cause by logging memory at various points or using a profiler, and go from
there. Is it in the model or
the view? Your code or swing? I've heard of some weirdness if you slow
down the event dispatch thread too much by not using threads, or conversely,
if you use threads, but do not terminate them properly. Regardless,
something is holding on to the references, either in Swing or your own app.
>However...if I call hide() on the main window or minimize the application,
>the app's footprint drops to around 1.4 meg.
This probably isn't cleaning up the objects, it's shifting them from
physical to virtual memory.
Check out these articles on weak references/leaks/swing etc.
Express yourself instantly with MSN Messenger! Download today - it's FREE!
More information about the ajug-members