aboutsummaryrefslogtreecommitdiff
path: root/gc.h
diff options
context:
space:
mode:
Diffstat (limited to 'gc.h')
-rw-r--r--gc.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/gc.h b/gc.h
new file mode 100644
index 0000000..417462f
--- /dev/null
+++ b/gc.h
@@ -0,0 +1,31 @@
+#ifndef GC_H
+#define GC_H
+
+#include "model.h"
+#include <map>
+
+const int GC_QUEUE_SIZE = 262144;
+
+typedef std::map<EvalObj*, size_t> EvalObj2Int;
+
+class GarbageCollector {
+
+ struct PendingEntry {
+ EvalObj *obj;
+ PendingEntry *next;
+ PendingEntry(EvalObj *obj, PendingEntry *next);
+ };
+
+ EvalObj2Int mapping;
+ size_t pend_cnt;
+ PendingEntry *pending_list;
+
+ public:
+ void force();
+ void expose(EvalObj *ptr);
+ EvalObj *attach(EvalObj *ptr);
+};
+
+extern GarbageCollector gc;
+
+#endif