fixed large allocations in debug 64 with static addresses
@@ -974,6 +974,9 @@ void hl_free( hl_alloc *a ) {
#ifdef HL_WIN
# if defined(GC_DEBUG) && defined(HL_64)
+# define STATIC_ADDRESS
+# endif
+# ifdef STATIC_ADDRESS
// force out of 32 bits addresses to check loss of precision
static char *start_address = (char*)0x100000000;
# else
@@ -988,7 +991,7 @@ HL_PRIM void *hl_alloc_executable_memory( int size ) {
#endif
#if defined(HL_WIN)
void *ptr = VirtualAlloc(start_address,size,MEM_RESERVE|MEM_COMMIT,PAGE_EXECUTE_READWRITE);
-# if defined(GC_DEBUG) && defined(HL_64)
+# ifdef STATIC_ADDRESS
start_address += size + ((-size) & (GC_PAGE_SIZE - 1));
# endif
return ptr;
@@ -1017,7 +1020,11 @@ void ps_free_align( void *ptr, int size );
static void *gc_alloc_page_memory( int size ) {
#if defined(HL_WIN)
void *ptr = VirtualAlloc(start_address,size,MEM_RESERVE|MEM_COMMIT,PAGE_READWRITE);
-# if defined(GC_DEBUG) && defined(HL_64)
+# ifdef STATIC_ADDRESS
+ if( ptr == NULL && start_address ) {
+ start_address = NULL;
+ return gc_alloc_page_memory(size);
+ }
start_address += size + ((-size) & (GC_PAGE_SIZE - 1));
# endif
return ptr;
