Patch: memory leak in java/lang/natClass.cc

Tom Tromey tromey@redhat.com
Wed Jul 2 04:02:00 GMT 2003


>>>>> "Michael" == Michael Koch <konqueror@gmx.de> writes:

Michael> I found another memory leak in java/lang/natClass.cc in 
Michael> _Jv_PrepareConstantTimeTables. The attached patch moves two abortion 
Michael> checks before the allocation of memory.
Michael> Okay to commit to trunk ?

I don't think this change is correct.  With this patch,
klass->ancestors will remain NULL.  However that indicates that the
tables haven't been prepared at all.

What do you think about that?

There is still a leak here.  This memory should be properly freed when
the class is finalized.  One way would be to add code to
Class.finalize.  However, I'd really like to get rid of this method
entirely, if possible.  So another approach would be to arrange for
some of these fields to be allocated via the collector (and marked as
well, of course).

Tom



More information about the Java-patches mailing list