diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f5eab5..6494993 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,7 +98,8 @@ endif() # We use OpenMP to speed up some geometric operations, but it's optional. include(FindOpenMP) -if(OpenMP_FOUND) +# No MinGW distribution actually ships an OpenMP runtime, but FindOpenMP detects it anyway. +if(OpenMP_FOUND AND NOT MINGW) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") else() message(WARNING "OpenMP not found, geometric operations will be single-threaded") diff --git a/src/platform/utilwin.cpp b/src/platform/utilwin.cpp index 4e45280..172039a 100644 --- a/src/platform/utilwin.cpp +++ b/src/platform/utilwin.cpp @@ -13,7 +13,7 @@ #include namespace SolveSpace { -static HANDLE PermHeap, TempHeap; +static HANDLE TempHeap; void dbp(const char *str, ...) { @@ -51,23 +51,15 @@ void FreeAllTemporary() { if(TempHeap) HeapDestroy(TempHeap); TempHeap = HeapCreate(HEAP_NO_SERIALIZE, 1024*1024*20, 0); - // This is a good place to validate, because it gets called fairly - // often. - vl(); } void *MemAlloc(size_t n) { - void *p = HeapAlloc(PermHeap, HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY, n); + void *p = malloc(n); ssassert(p != NULL, "Cannot allocate memory"); return p; } void MemFree(void *p) { - HeapFree(PermHeap, HEAP_NO_SERIALIZE, p); -} - -void vl() { - ssassert(HeapValidate(TempHeap, HEAP_NO_SERIALIZE, NULL), "Corrupted heap"); - ssassert(HeapValidate(PermHeap, HEAP_NO_SERIALIZE, NULL), "Corrupted heap"); + free(p); } std::vector InitPlatform(int argc, char **argv) { @@ -81,8 +73,6 @@ std::vector InitPlatform(int argc, char **argv) { } #endif - // Create the heap used for long-lived stuff (that gets freed piecewise). - PermHeap = HeapCreate(HEAP_NO_SERIALIZE, 1024*1024*20, 0); // Create the heap that we use to store Exprs and other temp stuff. FreeAllTemporary(); diff --git a/src/solvespace.h b/src/solvespace.h index 2a55302..fea705e 100644 --- a/src/solvespace.h +++ b/src/solvespace.h @@ -152,7 +152,6 @@ void *AllocTemporary(size_t n); void FreeAllTemporary(); void *MemAlloc(size_t n); void MemFree(void *p); -void vl(); // debug function to validate heaps // End of platform-specific functions //================