From: Bryce McKinlay Date: Thu, 2 Oct 2003 07:10:34 +0000 (+0000) Subject: re PR libgcj/12475 (Stack traces leak memory) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fddb33d2cd74d9bfd6951802ea075ad122ad1571;p=gcc.git re PR libgcj/12475 (Stack traces leak memory) Fix PR libgcj/12475 * gnu/gcj/runtime/StackTrace.java (finalize): Declare. * gnu/gcj/runtime/natStackTrace.cc (finalize): New. Free "addrs". From-SVN: r72012 --- diff --git a/libjava/ChangeLog b/libjava/ChangeLog index e8c98bd8480..2ab3393a77a 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2003-10-01 Bryce McKinlay + + Fix PR libgcj/12475 + * gnu/gcj/runtime/StackTrace.java (finalize): Declare. + * gnu/gcj/runtime/natStackTrace.cc (finalize): New. Free "addrs". + 2003-10-01 Tom Tromey * gnu/gcj/runtime/FirstThread.java (getMain): Fixed indentation. diff --git a/libjava/gnu/gcj/runtime/StackTrace.java b/libjava/gnu/gcj/runtime/StackTrace.java index 684ee4fd997..c9f5a1a26e8 100644 --- a/libjava/gnu/gcj/runtime/StackTrace.java +++ b/libjava/gnu/gcj/runtime/StackTrace.java @@ -157,6 +157,7 @@ public final class StackTrace } private native void fillInStackTrace(int n, int offset); + protected native void finalize(); private static native MethodRef getCompiledMethodRef(RawData addr); private static IdentityHashMap map = new IdentityHashMap(); diff --git a/libjava/gnu/gcj/runtime/natStackTrace.cc b/libjava/gnu/gcj/runtime/natStackTrace.cc index af8889beb52..5e5aed87e5c 100644 --- a/libjava/gnu/gcj/runtime/natStackTrace.cc +++ b/libjava/gnu/gcj/runtime/natStackTrace.cc @@ -200,4 +200,9 @@ gnu::gcj::runtime::StackTrace::update(void) } } - +void +gnu::gcj::runtime::StackTrace::finalize(void) +{ + if (addrs != NULL) + _Jv_Free (addrs); +}