PATCH: dispose Graphics after each paint, to recover resources (particularly memory)

Scott Gilbertson scottg@mantatest.com
Thu Jan 16 20:56:00 GMT 2003


This patch prevents awt paint events from chewing up all your RAM (128M in
my case).

Oscar Pearce posted this code on the java mailing list.  I built it and
tested it with my application.  Before the patch, my application would crash
with a kernel "out of memory" error.  Now it doesn't.  I originally thought
I'd have to modify some dispose methods in xlib to propagate between
classes, but that seems already to have been done.

Index: libjava/ChangeLog
from  Oscar Pearce <oscar@pearceenterprises.com> and Scott Gilbertson
<scottg@mantatest.com>

 * java.awt.Component.processPaintEvent: now disposes Graphics object each
pass, to recover resources

patch is attached.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20030116_GraphicsDispose.patch
Type: application/octet-stream
Size: 1355 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20030116/35072f31/attachment.obj>


More information about the Java-patches mailing list