Print this page


Split Split Close
Expand all
Collapse all
          --- old/src/share/vm/memory/allocation.cpp
          +++ new/src/share/vm/memory/allocation.cpp
↓ open down ↓ 552 lines elided ↑ open up ↑
 553  553  void Arena::signal_out_of_memory(size_t sz, const char* whence) const {
 554  554    vm_exit_out_of_memory(sz, OOM_MALLOC_ERROR, whence);
 555  555  }
 556  556  
 557  557  // Grow a new Chunk
 558  558  void* Arena::grow(size_t x, AllocFailType alloc_failmode) {
 559  559    // Get minimal required size.  Either real big, or even bigger for giant objs
 560  560    size_t len = MAX2(x, (size_t) Chunk::size);
 561  561  
 562  562    Chunk *k = _chunk;            // Get filled-up chunk address
 563      -  _chunk = new (alloc_failmode, len) Chunk(len);
 564  563  
 565      -  if (_chunk == NULL) {
      564 +  Chunk* tmp_chunk;
      565 +  tmp_chunk = new (alloc_failmode, len) Chunk(len);
      566 +  if (tmp_chunk == NULL) {
 566  567      return NULL;
 567  568    }
      569 +  _chunk = tmp_chunk;
      570 +
 568  571    if (k) k->set_next(_chunk);   // Append new chunk to end of linked list
 569  572    else _first = _chunk;
 570  573    _hwm  = _chunk->bottom();     // Save the cached hwm, max
 571  574    _max =  _chunk->top();
 572  575    set_size_in_bytes(size_in_bytes() + len);
 573  576    void* result = _hwm;
 574  577    _hwm += x;
 575  578    return result;
 576  579  }
 577  580  
↓ open down ↓ 245 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX