8085987: Vm crash "not long aligned" in nsk/stress/metaspace/jck60/jck6* tests
Summary: The word size being allocated needs to be rounded up.
Reviewed-by: jmasa, tbenson
--- a/hotspot/src/share/vm/memory/metaspace.cpp Fri Jun 19 13:03:58 2015 +0000
+++ b/hotspot/src/share/vm/memory/metaspace.cpp Thu Jun 18 16:28:04 2015 -0400
@@ -2423,7 +2423,9 @@
* will be made to allocate a small chunk.
*/
MetaWord* SpaceManager::get_small_chunk_and_allocate(size_t word_size) {
- if (word_size + Metachunk::overhead() > small_chunk_size()) {
+ size_t raw_word_size = get_raw_word_size(word_size);
+
+ if (raw_word_size + Metachunk::overhead() > small_chunk_size()) {
return NULL;
}
@@ -2438,9 +2440,9 @@
// Add chunk to the in-use chunk list and do an allocation from it.
// Add to this manager's list of chunks in use.
add_chunk(chunk, false);
- mem = chunk->allocate(word_size);
-
- inc_used_metrics(word_size);
+ mem = chunk->allocate(raw_word_size);
+
+ inc_used_metrics(raw_word_size);
// Track metaspace memory usage statistic.
track_metaspace_memory_usage();