comparison src/share/vm/memory/allocation.cpp @ 10161:746b070f5022

8011661: Insufficient memory message says "malloc" when sometimes it should say "mmap" Reviewed-by: coleenp, zgu, hseigel
author ccheung
date Tue, 30 Apr 2013 11:56:52 -0700
parents 5a9fa2ba85f0
children f9be75d21404 7ee0d5c53c78
comparison
equal deleted inserted replaced
10160:ed5a590835a4 10161:746b070f5022
257 _num_used++; 257 _num_used++;
258 p = get_first(); 258 p = get_first();
259 } 259 }
260 if (p == NULL) p = os::malloc(bytes, mtChunk, CURRENT_PC); 260 if (p == NULL) p = os::malloc(bytes, mtChunk, CURRENT_PC);
261 if (p == NULL) 261 if (p == NULL)
262 vm_exit_out_of_memory(bytes, "ChunkPool::allocate"); 262 vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "ChunkPool::allocate");
263 263
264 return p; 264 return p;
265 } 265 }
266 266
267 // Return a chunk to the pool 267 // Return a chunk to the pool
369 case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes); 369 case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes);
370 case Chunk::init_size: return ChunkPool::small_pool()->allocate(bytes); 370 case Chunk::init_size: return ChunkPool::small_pool()->allocate(bytes);
371 default: { 371 default: {
372 void *p = os::malloc(bytes, mtChunk, CALLER_PC); 372 void *p = os::malloc(bytes, mtChunk, CALLER_PC);
373 if (p == NULL) 373 if (p == NULL)
374 vm_exit_out_of_memory(bytes, "Chunk::new"); 374 vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "Chunk::new");
375 return p; 375 return p;
376 } 376 }
377 } 377 }
378 } 378 }
379 379
529 } 529 }
530 return sum; // Return total consumed space. 530 return sum; // Return total consumed space.
531 } 531 }
532 532
533 void Arena::signal_out_of_memory(size_t sz, const char* whence) const { 533 void Arena::signal_out_of_memory(size_t sz, const char* whence) const {
534 vm_exit_out_of_memory(sz, whence); 534 vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, whence);
535 } 535 }
536 536
537 // Grow a new Chunk 537 // Grow a new Chunk
538 void* Arena::grow(size_t x, AllocFailType alloc_failmode) { 538 void* Arena::grow(size_t x, AllocFailType alloc_failmode) {
539 // Get minimal required size. Either real big, or even bigger for giant objs 539 // Get minimal required size. Either real big, or even bigger for giant objs