Ver código fonte

Disable ems memory allocator heap corruption check when GC is enabled (#2838)

Wenyong Huang 2 anos atrás
pai
commit
8e5ab79968

+ 2 - 0
core/shared/mem-alloc/ems/ems_alloc.c

@@ -772,10 +772,12 @@ gc_alloc_wo_internal(void *vheap, gc_size_t size, const char *file, int line)
         /* integer overflow */
         return NULL;
 
+#if BH_ENABLE_GC_CORRUPTION_CHECK != 0
     if (heap->is_heap_corrupted) {
         os_printf("[GC_ERROR]Heap is corrupted, allocate memory failed.\n");
         return NULL;
     }
+#endif
 
     LOCK_HEAP(heap);
 

+ 7 - 1
core/shared/mem-alloc/mem_alloc.cmake

@@ -11,7 +11,13 @@ if (WAMR_BUILD_GC_VERIFY EQUAL 1)
 endif ()
 
 if (NOT DEFINED WAMR_BUILD_GC_CORRUPTION_CHECK)
-    set (WAMR_BUILD_GC_CORRUPTION_CHECK 1)
+    # Disable memory allocator heap corruption check
+    # when GC is enabled
+    if (WAMR_BUILD_GC EQUAL 1)
+        set (WAMR_BUILD_GC_CORRUPTION_CHECK 0)
+    else ()
+        set (WAMR_BUILD_GC_CORRUPTION_CHECK 1)
+    endif ()
 endif ()
 
 if (WAMR_BUILD_GC_CORRUPTION_CHECK EQUAL 0)