public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@avtrex.com>
To: Java Patch List <java-patches@gcc.gnu.org>
Subject: Patch: Add new _Jv_SetGCFreeSpaceDivisor method to libgcj.
Date: Sun, 21 Oct 2007 05:58:00 -0000	[thread overview]
Message-ID: <471AEA80.4040301@avtrex.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 796 bytes --]

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.


[-- Attachment #2: freespacedivisor.diff --]
[-- Type: text/x-patch, Size: 1004 bytes --]

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)
 {

             reply	other threads:[~2007-10-21  5:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-21  5:58 David Daney [this message]
2007-10-22  9:26 ` Andrew Haley
2007-10-22 17:13   ` David Daney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=471AEA80.4040301@avtrex.com \
    --to=ddaney@avtrex.com \
    --cc=java-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).