Re: Another garbage collection question



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

.



Relevant Pages

  • Re: Another garbage collection question
    ... I know I can use command line arguments to control ... but this game is to be launched by a double click. ... is it on the heap or on the pile is it exists) ...
    (comp.lang.java.programmer)
  • Another garbage collection question
    ... I know I can use command line arguments to control ... but this game is to be launched by a double click. ... is it on the heap or on the pile is it exists) ...
    (comp.lang.java.programmer)
  • Re: C++ sucks for games
    ... > Game programmers need efficient and deterministic garbage collection. ... garbage collection does not corrupt memory unless the garbage ... available in some implementations of various languages). ...
    (comp.lang.lisp)
  • Re: C++ sucks for games
    ... > Game programmers need efficient and deterministic garbage collection. ... garbage collection does not corrupt memory unless the garbage ... available in some implementations of various languages). ...
    (comp.lang.cpp)
  • Re: P-Source: A Guide to the Apple Pascal System
    ... Activation frames will be allocated from these chunks until it is ... then allocate another chunk and link to it. ... allocated dynamically, managed like anything else in the heap, and even ... I will have a background thread that runs garbage collection and calls ...
    (comp.sys.apple2)