equal
deleted
inserted
replaced
2421 * available and OOME would be thrown. Instead of doing that, |
2421 * available and OOME would be thrown. Instead of doing that, |
2422 * if the allocation request size fits in a small chunk, an attempt |
2422 * if the allocation request size fits in a small chunk, an attempt |
2423 * will be made to allocate a small chunk. |
2423 * will be made to allocate a small chunk. |
2424 */ |
2424 */ |
2425 MetaWord* SpaceManager::get_small_chunk_and_allocate(size_t word_size) { |
2425 MetaWord* SpaceManager::get_small_chunk_and_allocate(size_t word_size) { |
2426 if (word_size + Metachunk::overhead() > small_chunk_size()) { |
2426 size_t raw_word_size = get_raw_word_size(word_size); |
|
2427 |
|
2428 if (raw_word_size + Metachunk::overhead() > small_chunk_size()) { |
2427 return NULL; |
2429 return NULL; |
2428 } |
2430 } |
2429 |
2431 |
2430 MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag); |
2432 MutexLockerEx cl(lock(), Mutex::_no_safepoint_check_flag); |
2431 MutexLockerEx cl1(expand_lock(), Mutex::_no_safepoint_check_flag); |
2433 MutexLockerEx cl1(expand_lock(), Mutex::_no_safepoint_check_flag); |
2436 |
2438 |
2437 if (chunk != NULL) { |
2439 if (chunk != NULL) { |
2438 // Add chunk to the in-use chunk list and do an allocation from it. |
2440 // Add chunk to the in-use chunk list and do an allocation from it. |
2439 // Add to this manager's list of chunks in use. |
2441 // Add to this manager's list of chunks in use. |
2440 add_chunk(chunk, false); |
2442 add_chunk(chunk, false); |
2441 mem = chunk->allocate(word_size); |
2443 mem = chunk->allocate(raw_word_size); |
2442 |
2444 |
2443 inc_used_metrics(word_size); |
2445 inc_used_metrics(raw_word_size); |
2444 |
2446 |
2445 // Track metaspace memory usage statistic. |
2447 // Track metaspace memory usage statistic. |
2446 track_metaspace_memory_usage(); |
2448 track_metaspace_memory_usage(); |
2447 } |
2449 } |
2448 |
2450 |