8085987: Vm crash "not long aligned" in nsk/stress/metaspace/jck60/jck6* tests
authorjprovino
Thu, 18 Jun 2015 16:28:04 -0400
changeset 31374 9280d10f1f26
parent 31373 21f527ce09e0
child 31375 aa5ecd9a5716
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
hotspot/src/share/vm/memory/metaspace.cpp
--- 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();