diff src/share/vm/prims/jvm.cpp @ 342:37f87013dfd8

6711316: Open source the Garbage-First garbage collector Summary: First mercurial integration of the code for the Garbage-First garbage collector. Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author ysr
date Thu, 05 Jun 2008 15:57:56 -0700
parents 018d5b58dd4f
children 1ee8caae33af
line wrap: on
line diff
--- a/src/share/vm/prims/jvm.cpp	Wed Jun 04 13:51:09 2008 -0700
+++ b/src/share/vm/prims/jvm.cpp	Thu Jun 05 15:57:56 2008 -0700
@@ -377,7 +377,11 @@
 JVM_ENTRY_NO_ENV(jlong, JVM_FreeMemory(void))
   JVMWrapper("JVM_FreeMemory");
   CollectedHeap* ch = Universe::heap();
-  size_t n = ch->capacity() - ch->used();
+  size_t n;
+  {
+     MutexLocker x(Heap_lock);
+     n = ch->capacity() - ch->used();
+  }
   return convert_size_t_to_jlong(n);
 JVM_END