Incremental Garbage Collection

This seems to be one of those things everybody knows, but I can’t find any real documentation on it.

Is there a way to turn on incremental garbage collection in my applet other than through the plugin control panel? It seems to me that the answer is “no.” Why can’t I do this? Or, if I can, how do I do it?

Thanks, I’m starting to get this stuff figured out,

  • eli

No.

Cas :slight_smile:

You could consider using java web start instead of creating applets. You will be able to select the gc type you need plus everything else you can’t do in an applet :slight_smile:

[quote]You could consider using java web start instead of creating applets. You will be able to select the gc type you need plus everything else you can’t do in an applet :slight_smile:
[/quote]
You can??? when did they add this to JNLP? I thought all you could change was the default memory sizes. In fact I think there is a bug requesting access to more VM options just for things like this.

Actually I’ve been doing some rooting about: try setting

-Dhotspot.vm.args=-Xincgc

in the JNLP and see what it does…

JNLP syntax:

It probably won’t work… but you never know. And it almost certainly won’t be changeable at runtime.

Cas :slight_smile:

[quote]You can when did they add this to JNLP? I thought all you could change was the default memory sizes. In fact I think there is a bug requesting access to more VM options just for things like this.
[/quote]
Well, in my old Duke Rogers game, I have this:


  <resources> 
    <j2se version="1.4+"/> 
    <property name="sun.java2d.ddscale" value="true"/>
    <property name="sun.java2d.noddraw" value="false"/>
    <property name="sun.java2d.ddoffscreen" value="true"/>
    <property name="sun.java2d.d3d" value="true"/>
    <jar href="DukeRogers.jar"/>
    <jar href="Mus1.jar"/>
    <jar href="Gfx.jar"/>
    <jar href="Sfx.jar"/>
  </resources> 

and that definitely works (I checked).

I kind of assumed setting the properties like Cas described would work too, but I must confess I haven’t tried…

Erik

Setting properties and changing VM flags are completely different. See the JNLP spec for how you set the heap size for example. (Hint, not with properties.) Something similar is needed for GC options and such.

I haven’t tested it, but I think the hotspot.vm.args property is set from the other VM flags, it is not read by the VM. I would love to be wrong about that though.

Remember that those properties you mentioned are used by Java code - NOT the VM.

[quote]Remember that those properties you mentioned are used by Java code - NOT the VM.
[/quote]
Hm. You have point there.
Sorry, I was too quick with my assumptions :-/

[quote]In fact I think there is a bug requesting access to more VM options just for things like this.
[/quote]
I guess I’ll have to vote for that bug :slight_smile:

Yeah if it was a property I could just set it - in fact although it does appear in javaplugin.jre.params, setting that to “-Xincgc” doesn’t work (obviously no big surprise, but it was worth a shot.)

Is there any explanation from Sun about why we can’t do this? I know, “their normal garbage collection is so good that I’ll never see pauses unless I’m creating too many transitional objects and it’s all my fault for bad coding practices.” (My code ain’t pausing for 2 tenths of a second to collect up 100k of RAM it doesn’t need.)

It seems trivial to do, and it would improve the apparent performance of a whole range of programs.

What’s the bug number? I haven’t found it…

  • eli

Hmmm platfrom independant, but to set some of the most important parameters for performance you need shell scripts or batch files or whatever? :’(

Well now that we get a timer that deserves his name, i got 3 free bug votes :smiley:

Or were there any official statements how that stuff should work, or what you are supposed to do to select gc-type for the end-user?

http://developer.java.sun.com/developer/bugParade/bugs/4790673.html

Woot!

FIXED FOR TIGER

oh sweet. is there something similar for jars on the horizon?

or a rfe for gc tuning with jars?

[quote]oh sweet. is there something similar for jars on the horizon?

or a rfe for gc tuning with jars?
[/quote]
For running an app in a jar, use vm options to tune the gc. Tuning the gc is very specific to the used vm, so using vm options makes sense.

Erik