[vmkit-commits] [vmkit] r82142 - in /vmkit/trunk/lib/JnJVM/VMCore: JnjvmClassLoader.cpp JnjvmClassLoader.h

Nicolas Geoffray nicolas.geoffray at lip6.fr
Thu Sep 17 05:06:44 PDT 2009


Author: geoffray
Date: Thu Sep 17 07:06:43 2009
New Revision: 82142

URL: http://llvm.org/viewvc/llvm-project?rev=82142&view=rev
Log:
Delete the allocator of a class loader after the class loader
has been deallocated: the allocator owns the memory of the
class loader therefore can not be deleted by the class loader.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
    vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h

Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp?rev=82142&r1=82141&r2=82142&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.cpp Thu Sep 17 07:06:43 2009
@@ -898,7 +898,7 @@
 }
 
 JnjvmClassLoader::~JnjvmClassLoader() {
-  
+
   if (isolate)
     isolate->removeMethodsInFunctionMap(this);
 
@@ -928,7 +928,9 @@
   }
 
   delete TheCompiler;
-  delete &allocator;
+
+  // Don't delete the allocator. The caller of this method must
+  // delete it after the current object is deleted.
 }
 
 

Modified: vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h?rev=82142&r1=82141&r2=82142&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/JnjvmClassLoader.h Thu Sep 17 07:06:43 2009
@@ -442,7 +442,10 @@
   /// ~VMClassLoader - Delete the internal class loader.
   ///
   static void staticDestructor(VMClassLoader* obj) {
-    if (obj->JCL) obj->JCL->~JnjvmClassLoader();
+    if (obj->JCL) {
+      obj->JCL->~JnjvmClassLoader();
+      delete &(obj->JCL->allocator);
+    }
   }
 
   /// VMClassLoader - Default constructors.





More information about the vmkit-commits mailing list