comparison src/share/vm/services/mallocTracker.cpp @ 20509:1ff288f0dae4

8058818: Allocation of more then 1G of memory using Unsafe.allocateMemory is still causing a fatal error on 32bit platforms Summary: The assert was firing for NMT_Off and minimal too even though the size isn't used. Reviewed-by: gtriantafill, dholmes
author coleenp
date Thu, 25 Sep 2014 07:52:32 -0400
parents 833b0f92429a
children 417e3b8d04c5
comparison
equal deleted inserted replaced
20506:2d6a3328ec99 20509:1ff288f0dae4
138 138
139 if (malloc_base == NULL) { 139 if (malloc_base == NULL) {
140 return NULL; 140 return NULL;
141 } 141 }
142 142
143 // Check malloc size, size has to <= MAX_MALLOC_SIZE. This is only possible on 32-bit
144 // systems, when malloc size >= 1GB, but is is safe to assume it won't happen.
145 if (size > MAX_MALLOC_SIZE) {
146 fatal("Should not use malloc for big memory block, use virtual memory instead");
147 }
148 // Uses placement global new operator to initialize malloc header 143 // Uses placement global new operator to initialize malloc header
149 switch(level) { 144 switch(level) {
150 case NMT_off: 145 case NMT_off:
151 return malloc_base; 146 return malloc_base;
152 case NMT_minimal: { 147 case NMT_minimal: {
153 MallocHeader* hdr = ::new (malloc_base) MallocHeader(); 148 MallocHeader* hdr = ::new (malloc_base) MallocHeader();
154 break; 149 break;
155 } 150 }
156 case NMT_summary: { 151 case NMT_summary: {
152 assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
157 header = ::new (malloc_base) MallocHeader(size, flags); 153 header = ::new (malloc_base) MallocHeader(size, flags);
158 break; 154 break;
159 } 155 }
160 case NMT_detail: { 156 case NMT_detail: {
157 assert(size <= MAX_MALLOC_SIZE, "malloc size overrun for NMT");
161 header = ::new (malloc_base) MallocHeader(size, flags, stack); 158 header = ::new (malloc_base) MallocHeader(size, flags, stack);
162 break; 159 break;
163 } 160 }
164 default: 161 default:
165 ShouldNotReachHere(); 162 ShouldNotReachHere();