Mercurial > hg > graal-jvmci-8
comparison src/share/vm/memory/heap.cpp @ 2353:1c0cf339481b
7025742: Can not use CodeCache::unallocated_capacity() with fragmented CodeCache
Summary: Use largest_free_block() instead of unallocated_capacity().
Reviewed-by: iveresov, never, ysr
author | kvn |
---|---|
date | Wed, 09 Mar 2011 09:15:16 -0800 |
parents | 51bd2d261853 |
children | 1d1603768966 |
comparison
equal
deleted
inserted
replaced
2352:425688247f3d | 2353:1c0cf339481b |
---|---|
314 | 314 |
315 return l; | 315 return l; |
316 } | 316 } |
317 | 317 |
318 size_t CodeHeap::largest_free_block() const { | 318 size_t CodeHeap::largest_free_block() const { |
319 // First check unused space excluding free blocks. | |
320 size_t free_sz = size(_free_segments); | |
321 size_t unused = max_capacity() - allocated_capacity() - free_sz; | |
322 if (unused >= free_sz) | |
323 return unused; | |
324 | |
325 // Now check largest free block. | |
319 size_t len = 0; | 326 size_t len = 0; |
320 for (FreeBlock* b = _freelist; b != NULL; b = b->link()) { | 327 for (FreeBlock* b = _freelist; b != NULL; b = b->link()) { |
321 if (b->length() > len) | 328 if (b->length() > len) |
322 len = b->length(); | 329 len = b->length(); |
323 } | 330 } |
324 return size(len); | 331 return MAX2(unused, size(len)); |
325 } | 332 } |
326 | 333 |
327 // Free list management | 334 // Free list management |
328 | 335 |
329 FreeBlock *CodeHeap::following_block(FreeBlock *b) { | 336 FreeBlock *CodeHeap::following_block(FreeBlock *b) { |