This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: Add new _Jv_SetGCFreeSpaceDivisor method to libgcj.
- From: David Daney <ddaney at avtrex dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Sat, 20 Oct 2007 22:58:24 -0700
- Subject: Patch: Add new _Jv_SetGCFreeSpaceDivisor method to libgcj.
As I mentioned previously, GC_free_space_divisor is no longer exported
from libgcj.so.
Access to this GC tuning parameter is needed on systems where the
maximum heap size is set. If GC_free_space_divisor is not set to a
value larger than its default value of three, the heap can easily get
fragmented in such a manner that OutOfMemoryErrors are thrown even
though there is plenty of free memory.
Since the loss of the ability to adjust GC_free_space_divisor is a
regression, this should be committed even though we are in stage three.
Tested on x86_64-pc-linux-gnu in libjava with no regressions.
OK to commit?
2007-10-20 David Daney <ddaney@avtrex.com>
* include/jvm.h (_Jv_SetGCFreeSpaceDivisor): Declare new function.
* boehm.cc (_Jv_SetGCFreeSpaceDivisor): Define it.
Index: include/jvm.h
===================================================================
--- include/jvm.h (revision 129428)
+++ include/jvm.h (working copy)
@@ -412,6 +412,10 @@ void _Jv_SetInitialHeapSize (const char
_Jv_GCSetMaximumHeapSize. */
void _Jv_SetMaximumHeapSize (const char *arg);
+/* External interface for setting the GC_free_space_divisor. Calls
+ GC_set_free_space_divisor and returns the old value. */
+int _Jv_SetGCFreeSpaceDivisor (int div);
+
/* Free the method cache, if one was allocated. This is only called
during thread deregistration. */
void _Jv_FreeMethodCache ();
Index: boehm.cc
===================================================================
--- boehm.cc (revision 129428)
+++ boehm.cc (working copy)
@@ -465,6 +465,12 @@ _Jv_GCSetMaximumHeapSize (size_t size)
GC_set_max_heap_size ((GC_word) size);
}
+int
+_Jv_SetGCFreeSpaceDivisor (int div)
+{
+ return (int)GC_set_free_space_divisor ((GC_word)div);
+}
+
void
_Jv_DisableGC (void)
{