diff --git a/runtime/src/main/cpp/Memory.cpp b/runtime/src/main/cpp/Memory.cpp index 2fcf7202b97..4e6226e4001 100644 --- a/runtime/src/main/cpp/Memory.cpp +++ b/runtime/src/main/cpp/Memory.cpp @@ -1552,7 +1552,6 @@ MemoryState* suspendMemory() { } void resumeMemory(MemoryState* state) { - RuntimeAssert(::memoryState == nullptr, "Cannot schedule on existing state"); ::memoryState = state; } @@ -2489,7 +2488,6 @@ MemoryState* InitMemory() { } void DeinitMemory(MemoryState* memoryState) { - ::memoryState = memoryState; deinitMemory(memoryState); } diff --git a/runtime/src/main/cpp/Runtime.cpp b/runtime/src/main/cpp/Runtime.cpp index 39b575fe1e2..017e16b14fd 100644 --- a/runtime/src/main/cpp/Runtime.cpp +++ b/runtime/src/main/cpp/Runtime.cpp @@ -101,6 +101,7 @@ RuntimeState* initRuntime() { } void deinitRuntime(RuntimeState* state) { + ResumeMemory(state->memoryState); bool lastRuntime = atomicAdd(&aliveRuntimesCount, -1) == 0; InitOrDeinitGlobalVariables(DEINIT_THREAD_LOCAL_GLOBALS); if (lastRuntime)