< prev index next >

src/hotspot/share/memory/arena.cpp

Print this page
rev 50962 : [mq]: 8207011


 318   // reset size before chop to avoid a rare racing condition
 319   // that can have total arena memory exceed total chunk memory
 320   set_size_in_bytes(0);
 321   _first->chop();
 322   reset();
 323 }
 324 
 325 // This is high traffic method, but many calls actually don't
 326 // change the size
 327 void Arena::set_size_in_bytes(size_t size) {
 328   if (_size_in_bytes != size) {
 329     long delta = (long)(size - size_in_bytes());
 330     _size_in_bytes = size;
 331     MemTracker::record_arena_size_change(delta, _flags);
 332   }
 333 }
 334 
 335 // Total of all Chunks in arena
 336 size_t Arena::used() const {
 337   size_t sum = _chunk->length() - (_max-_hwm); // Size leftover in this Chunk
 338   register Chunk *k = _first;
 339   while( k != _chunk) {         // Whilst have Chunks in a row
 340     sum += k->length();         // Total size of this Chunk
 341     k = k->next();              // Bump along to next Chunk
 342   }
 343   return sum;                   // Return total consumed space.
 344 }
 345 
 346 void Arena::signal_out_of_memory(size_t sz, const char* whence) const {
 347   vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, "%s", whence);
 348 }
 349 
 350 // Grow a new Chunk
 351 void* Arena::grow(size_t x, AllocFailType alloc_failmode) {
 352   // Get minimal required size.  Either real big, or even bigger for giant objs
 353   size_t len = MAX2(x, (size_t) Chunk::size);
 354 
 355   Chunk *k = _chunk;            // Get filled-up chunk address
 356   _chunk = new (alloc_failmode, len) Chunk(len);
 357 
 358   if (_chunk == NULL) {




 318   // reset size before chop to avoid a rare racing condition
 319   // that can have total arena memory exceed total chunk memory
 320   set_size_in_bytes(0);
 321   _first->chop();
 322   reset();
 323 }
 324 
 325 // This is high traffic method, but many calls actually don't
 326 // change the size
 327 void Arena::set_size_in_bytes(size_t size) {
 328   if (_size_in_bytes != size) {
 329     long delta = (long)(size - size_in_bytes());
 330     _size_in_bytes = size;
 331     MemTracker::record_arena_size_change(delta, _flags);
 332   }
 333 }
 334 
 335 // Total of all Chunks in arena
 336 size_t Arena::used() const {
 337   size_t sum = _chunk->length() - (_max-_hwm); // Size leftover in this Chunk
 338   Chunk *k = _first;
 339   while( k != _chunk) {         // Whilst have Chunks in a row
 340     sum += k->length();         // Total size of this Chunk
 341     k = k->next();              // Bump along to next Chunk
 342   }
 343   return sum;                   // Return total consumed space.
 344 }
 345 
 346 void Arena::signal_out_of_memory(size_t sz, const char* whence) const {
 347   vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, "%s", whence);
 348 }
 349 
 350 // Grow a new Chunk
 351 void* Arena::grow(size_t x, AllocFailType alloc_failmode) {
 352   // Get minimal required size.  Either real big, or even bigger for giant objs
 353   size_t len = MAX2(x, (size_t) Chunk::size);
 354 
 355   Chunk *k = _chunk;            // Get filled-up chunk address
 356   _chunk = new (alloc_failmode, len) Chunk(len);
 357 
 358   if (_chunk == NULL) {


< prev index next >