OSDN Git Service

Clear allocator in image writer
authorMathieu Chartier <mathieuc@google.com>
Tue, 22 Sep 2015 22:18:04 +0000 (15:18 -0700)
committerMathieu Chartier <mathieuc@google.com>
Tue, 22 Sep 2015 22:57:33 +0000 (15:57 -0700)
Doesn't fix any active bugs, just precautionary.

Change-Id: I32a89e00b1d5964ad77fb53eded55263fea5df00

compiler/image_writer.cc

index 955c575..d9f8fcb 100644 (file)
@@ -1362,6 +1362,10 @@ void ImageWriter::FixupObject(Object* orig, Object* copy) {
         // If src is a ClassLoader, set the class table to null so that it gets recreated by the
         // ClassLoader.
         down_cast<mirror::ClassLoader*>(copy)->SetClassTable(nullptr);
+        // Also set allocator to null to be safe. The allocator is created when we create the class
+        // table. We also never expect to unload things in the image since they are held live as
+        // roots.
+        down_cast<mirror::ClassLoader*>(copy)->SetAllocator(nullptr);
       }
     }
     FixupVisitor visitor(this, copy);