src/share/vm/memory/allocation.cpp

Print this page

        

@@ -558,15 +558,18 @@
 void* Arena::grow(size_t x, AllocFailType alloc_failmode) {
   // Get minimal required size.  Either real big, or even bigger for giant objs
   size_t len = MAX2(x, (size_t) Chunk::size);
 
   Chunk *k = _chunk;            // Get filled-up chunk address
-  _chunk = new (alloc_failmode, len) Chunk(len);
 
-  if (_chunk == NULL) {
+  Chunk* tmp_chunk;
+  tmp_chunk = new (alloc_failmode, len) Chunk(len);
+  if (tmp_chunk == NULL) {
     return NULL;
   }
+  _chunk = tmp_chunk;
+
   if (k) k->set_next(_chunk);   // Append new chunk to end of linked list
   else _first = _chunk;
   _hwm  = _chunk->bottom();     // Save the cached hwm, max
   _max =  _chunk->top();
   set_size_in_bytes(size_in_bytes() + len);