summaryrefslogtreecommitdiff
path: root/src/mixed_arena.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mixed_arena.h')
-rw-r--r--src/mixed_arena.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mixed_arena.h b/src/mixed_arena.h
index 82464d51e..dc8cbad5b 100644
--- a/src/mixed_arena.h
+++ b/src/mixed_arena.h
@@ -19,6 +19,8 @@
#include <vector>
+#include "support/threads.h"
+
//
// Arena allocation for mixed-type data.
//
@@ -29,6 +31,9 @@ struct MixedArena {
template<class T>
T* alloc() {
+ // this structure should not be modified by multiple threads at once.
+ assert(!wasm::ThreadPool::isRunning());
+
const size_t CHUNK = 10000;
size_t currSize = (sizeof(T) + 7) & (-8); // same alignment as malloc TODO optimize?
assert(currSize < CHUNK);
@@ -43,6 +48,8 @@ struct MixedArena {
}
void clear() {
+ assert(!wasm::ThreadPool::isRunning());
+
for (char* chunk : chunks) {
delete[] chunk;
}