equal
deleted
inserted
replaced
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 && alloc_failmode == AllocFailStrategy::EXIT_OOM) { |
261 if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) { |
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, alloc_failmode); |
369 case Chunk::medium_size: return ChunkPool::medium_pool()->allocate(bytes, alloc_failmode); |
370 case Chunk::init_size: return ChunkPool::small_pool()->allocate(bytes, alloc_failmode); |
370 case Chunk::init_size: return ChunkPool::small_pool()->allocate(bytes, alloc_failmode); |
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 && alloc_failmode == AllocFailStrategy::EXIT_OOM) { |
373 if (p == NULL && alloc_failmode == AllocFailStrategy::EXIT_OOM) { |
374 vm_exit_out_of_memory(bytes, "Chunk::new"); |
374 vm_exit_out_of_memory(bytes, OOM_MALLOC_ERROR, "Chunk::new"); |
375 } |
375 } |
376 return p; |
376 return p; |
377 } |
377 } |
378 } |
378 } |
379 } |
379 } |
530 } |
530 } |
531 return sum; // Return total consumed space. |
531 return sum; // Return total consumed space. |
532 } |
532 } |
533 |
533 |
534 void Arena::signal_out_of_memory(size_t sz, const char* whence) const { |
534 void Arena::signal_out_of_memory(size_t sz, const char* whence) const { |
535 vm_exit_out_of_memory(sz, whence); |
535 vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, whence); |
536 } |
536 } |
537 |
537 |
538 // Grow a new Chunk |
538 // Grow a new Chunk |
539 void* Arena::grow(size_t x, AllocFailType alloc_failmode) { |
539 void* Arena::grow(size_t x, AllocFailType alloc_failmode) { |
540 // Get minimal required size. Either real big, or even bigger for giant objs |
540 // Get minimal required size. Either real big, or even bigger for giant objs |