[3092] in java-interest

home help back first fref pref prev next nref lref last post

Re: dispose() on GC's [was Re: Finalize() ]

daemon@ATHENA.MIT.EDU (Jim Graham)
Mon Oct 30 16:40:34 1995

Date: Mon, 30 Oct 1995 11:53:09 -0800
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM, andruid@SLINKY.CS.NYU.EDU


> i have been wondering: if i call paint myself, by doing getGraphics()
> on something derived form Component, should a do a dispose() or
> finalize() on that GC when paint returns?  My interpretation of your
> comments is that that might be a good thing to do.

It would be better to use the "repaint()" method to cause your components
to repaint, but the answer to your question is yes, you should manually
dispose() the Graphics objects when you are done with them to free up the
system resources as soon as possible.  The finalize() method is only a
backup in case you forget...

				...jim
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post