Hi, Pravin,
I am sure my message won't help you much. But from my experience,
you might have loitering reference somewhere in your code that
does not release the references to unused objects. In this case,
garbage collection will not be able to help you. Although this
could happen in any Java code, but it usually leads to severe
memory leak in Swing because, for example, if you forget to release
a reference to an unused Frame, everything in it will not be
garbage collected.
Runtime.gc() and Runtime.runFinalisation() are at best a hint to
the JVM that it is a good chance to run garbage collection, but
they can not guarantee that the garbage collection will kick in
right away.
Having memory leak is a big headache. You might want to use
some heap profiler to check the memeory usage and object allocation
in your program. The best tool I know of is OptimizeIt. It is a
commercial product, but you can download a trial version and use
it for a limited period. (http://www.optimizeit.com/)
You also might find the following article interesting:
http://www.javaworld.com/javaworld/jw-06-1998/jw-06-techniques_p.html
Good luck,
Mingjian Song
> -----Original Message-----
> From: Pravin Shingade [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, February 28, 2001 12:10 AM
> To: [EMAIL PROTECTED]
> Subject: Garbage Collection
>
> Hi all,
> Can anybody tell me how to force a garbage collector or any other way to
> release the memory.
> My application is throwing OutOfMemoryError even in 128MB RAM system.
> I am using swing for GUI.
> I am calling
>
> Runtime.gc()
> Runtime.runFinalisation()
>
> but it hardly helps in performance improvement.
>
_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing