This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Controlling the garbage collector (GC) at RT?


Hi Hans,

There are also a number of environment variables that have some
impact on this.  Depending on your application, this may be
easier than Bryce's suggestion or completely useless.
They are documented in

gcc/boehm-gc/doc/README.environment

You might get the desired effect by setting GC_INITIAL_HEAP_SIZE
to something near what you expect the final size to be.
Deja vu! :-)
We've been there before (http://gcc.gnu.org/ml/java/2004-11/msg00143.html).
But all these environments are for initial configuration, so I think I
may go with Bryce's suggestion instead.

And in relation to that thread, what is the effect of adjusting
GC_free_space_divisor? (Maybe I should take that back in the old thread)

The collector tries to take such an explicit setting as a strong hint
that it should actually be using that much of the heap before collecting.
Sure, but I'm trying to avoid GC while the application is in a
"critical" state. Doing as you suggest, wouldn't that just make things
worse in case it starts collecting when it reaches the roof?
Then there's a lot to collect...

Am I the only one that think a GCJ interface for controlling the GC
would be neat?

// Martin

-----Original Message-----
From: java-owner@gcc.gnu.org [mailto:java-owner@gcc.gnu.org]On Behalf Of
Bryce McKinlay
Sent: Wednesday, February 02, 2005 12:07 PM
To: Martin Egholm Nielsen
Cc: java@gcc.gnu.org
Subject: Re: Controlling the garbage collector (GC) at RT?



Martin Egholm Nielsen wrote:



Does GCJ somehow support controlling the GC at runtime?
That is, e.g. configure it for different behaviour:

1) Run as you usually do
2) Please do not not run unless it is really needed
3) Don't run at all (let application die if it must)

Point 2 is actually what I'm after, but I'm reconsidering (as I'm writing) if it actually makes any sense.


The Boehm GC has the functions GC_enable() and GC_disable() which should do basically what you want. We don't have an interface to call these directly from Java, however, you could perhaps add your own interface and call the GC functions directly via CNI.

See boehm-gc/include.gc.h

Bryce







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]