This is the mail archive of the
mailing list for the Java project.
Re: Patch: memory leak in java/lang/natClass.cc
- From: Tom Tromey <tromey at redhat dot com>
- To: Michael Koch <konqueror at gmx dot de>
- Cc: java-patches at gcc dot gnu dot org
- Date: 01 Jul 2003 21:54:26 -0600
- Subject: Re: Patch: memory leak in java/lang/natClass.cc
- References: <firstname.lastname@example.org>
- Reply-to: tromey at redhat dot com
>>>>> "Michael" == Michael Koch <email@example.com> 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).