8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms

The assert was firing for NMT_Off and minimal too even though the size isn't used.

Reviewed-by: gtriantafill, dholmes
This commit is contained in:
Coleen Phillimore 2014-09-25 07:52:32 -04:00
parent ade3cd1920
commit 31b9cf6251
2 changed files with 56 additions and 5 deletions

View file

@ -140,11 +140,6 @@ void* MallocTracker::record_malloc(void* malloc_base, size_t size, MEMFLAGS flag
return NULL;
}
// Check malloc size, size has to <= MAX_MALLOC_SIZE. This is only possible on 32-bit
// systems, when malloc size >= 1GB, but is is safe to assume it won't happen.
if (size > MAX_MALLOC_SIZE) {
fatal("Should not use malloc for big memory block, use virtual memory instead");
}
// Uses placement global new operator to initialize malloc header
switch(level) {
case NMT_off:
@ -154,10 +149,12 @@ void* MallocTracker::record_malloc(void* malloc_base, size_t size, MEMFLAGS flag
break;
}
case NMT_summary: {
assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
header = ::new (malloc_base) MallocHeader(size, flags);
break;
}
case NMT_detail: {
assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
header = ::new (malloc_base) MallocHeader(size, flags, stack);
break;
}