156 } |
156 } |
157 #endif |
157 #endif |
158 |
158 |
159 // Delete later chunks |
159 // Delete later chunks |
160 if( _chunk->next() ) { |
160 if( _chunk->next() ) { |
|
161 // reset arena size before delete chunks. Otherwise, the total |
|
162 // arena size could exceed total chunk size |
|
163 assert(area->size_in_bytes() > size_in_bytes(), "Sanity check"); |
|
164 area->set_size_in_bytes(size_in_bytes()); |
161 _chunk->next_chop(); |
165 _chunk->next_chop(); |
|
166 } else { |
|
167 assert(area->size_in_bytes() == size_in_bytes(), "Sanity check"); |
162 } |
168 } |
163 // Roll back arena to saved top markers |
169 // Roll back arena to saved top markers |
164 area->_chunk = _chunk; |
170 area->_chunk = _chunk; |
165 area->_hwm = _hwm; |
171 area->_hwm = _hwm; |
166 area->_max = _max; |
172 area->_max = _max; |
167 area->set_size_in_bytes(_size_in_bytes); |
|
168 #ifdef ASSERT |
173 #ifdef ASSERT |
169 // clear out first chunk (to detect allocation bugs) |
174 // clear out first chunk (to detect allocation bugs) |
170 if (ZapVMHandleArea) { |
175 if (ZapVMHandleArea) { |
171 memset(_hwm, badHandleValue, _max - _hwm); |
176 memset(_hwm, badHandleValue, _max - _hwm); |
172 } |
177 } |