changeset 8572:8869bb2bc262

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
author jprovino
date Thu, 18 Jun 2015 16:28:04 -0400
parents bf2c494a8266
children 01a99de9d5cb
files src/share/vm/memory/metaspace.cpp
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/memory/metaspace.cpp	Fri Jun 19 13:03:58 2015 +0000
+++ b/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();