mymemory, threads: add allocator specifically for Thread
[model-checker.git] / threads-model.h
index e77e80c..eb0fd43 100644 (file)
@@ -126,6 +126,18 @@ public:
         * to allow their allocation/deallocation to follow the same pattern as
         * the rest of the backtracked/replayed program.
         */
         * to allow their allocation/deallocation to follow the same pattern as
         * the rest of the backtracked/replayed program.
         */
+       void * operator new(size_t size) {
+               return Thread_malloc(size);
+       }
+       void operator delete(void *p, size_t size) {
+               Thread_free(p);
+       }
+       void * operator new[](size_t size) {
+               return Thread_malloc(size);
+       }
+       void operator delete[](void *p, size_t size) {
+               Thread_free(p);
+       }
 private:
        int create_context();
 
 private:
        int create_context();