Mark stack create once per heap.
Mark stack is now created during heap initialization and is then re-used for each GC. This helps to prevent fragmentation of the heap.
Change-Id: I5dd1bdfb58452415b88bfeb0c05a41ecbca09696
diff --git a/src/heap.h b/src/heap.h
index 5b6b991..d368158 100644
--- a/src/heap.h
+++ b/src/heap.h
@@ -34,12 +34,13 @@
class AllocSpace;
class Class;
+class HeapBitmap;
class ImageSpace;
+class MarkStack;
class Object;
class Space;
-class Thread;
-class HeapBitmap;
class SpaceTest;
+class Thread;
class Heap {
public:
@@ -271,6 +272,9 @@
// True while the garbage collector is running.
bool is_gc_running_;
+ // Mark stack that we reuse to avoid re-allocating the mark stack
+ MarkStack* mark_stack_;
+
// Number of bytes allocated. Adjusted after each allocation and free.
size_t num_bytes_allocated_;