diff --git a/CMakeLists.txt b/CMakeLists.txt index 302a2fe1..f9ec20fb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,11 @@ if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Ox") add_definitions(-DNDEBUG) endif() + + # if(CMAKE_BUILD_TYPE STREQUAL "Debug") + # message(">> Enable Address Sanitizer") + # set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /fsanitize=address /Zi") + # endif() else() if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") @@ -99,6 +104,9 @@ if(PK_ENABLE_DETERMINISM) endif() endif() +find_package(Threads REQUIRED) +target_link_libraries(${PROJECT_NAME} Threads::Threads) + if(UNIX AND NOT APPLE) if(NOT PK_ENABLE_DETERMINISM) # use platform libm diff --git a/src/interpreter/vm.c b/src/interpreter/vm.c index fa3771fa..5bcd9a44 100644 --- a/src/interpreter/vm.c +++ b/src/interpreter/vm.c @@ -260,11 +260,11 @@ void VM__dtor(VM* self) { while(self->top_frame) VM__pop_frame(self); BinTree__dtor(&self->modules); - c11_vector__dtor(&self->types); FixedMemoryPool__dtor(&self->pool_frame); ValueStack__dtor(&self->stack); CachedNames__dtor(&self->cached_names); NameDict__dtor(&self->compile_time_funcs); + c11_vector__dtor(&self->types); } void VM__push_frame(VM* self, py_Frame* frame) {