maximum memory for gcj-compiled executable?

Lars Andersen lars@rimfaxe.com
Wed Apr 2 16:18:00 GMT 2003


Lots of people, myself included, thinks that some sort of compiler
option that sets minimum and maximum heap size is desirable.
Many apps uses a lot of memory in short bursts, and then discards it.
The default behaviour of the GC is to weigh in performance over size.
This is great news performancewise, since you don't want the GC to slow
down your app when there is lots of memory available. 
Some apps have a different nature, however. They need to coexist with
other apps, and share resources. Here it is important to control memory
usage. I have seen this many times now. The gcj app grows and grows, but
when i debug the heap usage it may be 90%+ unused. 
I've seen gcj compiled programs that ran just fine with <10MB heap, grow
to more than 100MB. For some apps space is the most important resource,
not performance.
Suggested solution :
add options to control heap, in particular initial and max sizes.
gcc/java/jvgenmain.c line 141 reads :
>>>>>>>>>>>>>>>>>>>>
fprintf (stream, "int main (int argc, const char **argv)\n");
fprintf (stream, "{\n");
fprintf (stream, " _Jv_Compiler_Properties = props;\n");
fprintf (stream, " JvRunMain (&%s, argc, argv);\n",mangled_classname);
fprintf (stream, "}\n");
<<<<<<<<<<<<<<<<<<<<
Erik Poupart wrote earlier : 
> libjava/prims.cc/_Jv_SetMaximumHeapSize() and _Jv_SetInitialHeapSize()
> would
> be interesting, but they have to be called before calling
>_Jv_RunMain(). Are
> they connected in one way or another to gcj compilation options?

How about adding those options to jvgenmain, and add
_Jv_SetInitialHeapSize() and _Jv_SetMaximumHeapSize() to jvgenmain.c
before JvRunMain()
Please correct me, if I'm way off here.
/Lars


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /