The Artima Developer Community
Sponsored Link

Legacy Design Forum
Finalization and Cleanup

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

User WeakReferences to hold your objects

Posted by alok on February 14, 2001 at 6:03 PM

First of all, you want to kick off your application with max memory wouldn't you? Are you by any chance restricting your application to 1MB right from the start?

You might want to hold your objects as WeakReferences instead of strong references. Doing so will prompt the GC to start reclaiming objects. System.gc() as Bill Venners pointed out somewhere on this forum is a "suggestion" and not a "command". The one way to interact with the GC at runtime would be to declare your objects as Weakreferences/Softreferences.

Check out

java.lang.ref. under JDK1.2
and this link
http://www.oreilly.com/catalog/javapt/chapter/ch04.html#_Toc474748094





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us