This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

FYI Patch: Fix memory leak PR 12475


This is a temporary hack to fix PR 12475. Eventually I plan to re-factor the stack trace stuff and get rid of the malloc.

Regards

Bryce.



2003-10-01 Bryce McKinlay <bryce@mckinlay.net.nz>

	Fix PR libgcj/12475
	* gnu/gcj/runtime/StackTrace.java (finalize): Declare.
	* gnu/gcj/runtime/natStackTrace.cc (finalize): New. Free "addrs".

Index: StackTrace.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/runtime/StackTrace.java,v
retrieving revision 1.2
diff -u -r1.2 StackTrace.java
--- StackTrace.java     20 Aug 2003 17:27:56 -0000      1.2
+++ StackTrace.java     2 Oct 2003 07:06:05 -0000
@@ -157,6 +157,7 @@
   }

   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();
Index: natStackTrace.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/gcj/runtime/natStackTrace.cc,v
retrieving revision 1.5
diff -u -r1.5 natStackTrace.cc
--- natStackTrace.cc    20 Aug 2003 17:27:56 -0000      1.5
+++ natStackTrace.cc    2 Oct 2003 07:06:05 -0000
@@ -200,4 +200,9 @@
     }
 }

-
+void
+gnu::gcj::runtime::StackTrace::finalize(void)
+{
+  if (addrs != NULL)
+    _Jv_Free (addrs);
+}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]