Re: Another garbage collection question
- From: KevinHanna <kevinhanna@xxxxxxxxx>
- Date: Fri, 1 Feb 2008 14:20:09 -0800 (PST)
On Feb 1, 9:35 am, "Ouabaine" <ouaba...@xxxxxxxxx> wrote:
Hello,
Yes, another question about garbage collection.
For my game, I am trying to minimise GC as much as possible, as it induces a
pause in the animation. I know I can use command line arguments to control
the GC, but this game is to be launched by a double click.
Put the command line arguments in the "shortcut" or batch file.
-> Is there a way to set the GC behaviour from within the application,
instead of the command line?
No, you can't control Java's garbage collection. You can only adjust
the heap and stack sizes to effect how often Java runs GC, the
ultimate decision is always left to the JVM. If garbage collection is
noticeably effecting the performance (and I'd be surprised if it is).
Then you'd be better served to make sure you're instantiating as few
objects as possible. Google the singleton design pattern.
-> When I declare an "int", a "short", a "double" in a method, is the space
taken on the heap, or is there a pile for this kind of data? (and what about
"String", is it on the heap or on the pile is it exists)
Primitives (int, short, double, long) are stored in the stack.
Objects (String, Integer, et cetera) are stored on the heap.
Thanks for your wise input.
Francois
.
- Follow-Ups:
- Re: Another garbage collection question
- From: Arne Vajhøj
- Re: Another garbage collection question
- From: Donkey Hot
- Re: Another garbage collection question
- From: Lew
- Re: Another garbage collection question
- References:
- Another garbage collection question
- From: Ouabaine
- Another garbage collection question
- Prev by Date: Re: Storing a sound as an object
- Next by Date: Re: how many objects r eligible for garbage Collection ?
- Previous by thread: Another garbage collection question
- Next by thread: Re: Another garbage collection question
- Index(es):
Relevant Pages
|
|