Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Garbage Collector question?
- From: chase@xxxxxxxxxxxxx (David Chase)
- Subject: Garbage Collector question?
- Date: Tue, 30 Nov 1999 09:58:36 -0500
At 01:37 PM 11/30/99 +0200, David Soroko wrote: >I vaguely remember that some (early) versions of hot spot were >so aggressive in their GC algorithm that local variables were >GCed while the were still in scope and not used beyond certain point. >I am not sure that this approach was in any sense illegal, just strange. As far as I know, this behavior is not illegal. If you read the spec, either language or VM, nowhere does it guarantee that you can reliably observe the size of the heap, nor does it guarantee that the total amount of memory "available" to you must remain constant. What this means is that it is very difficult to observe exactly when GC takes place, or exactly how much memory is consumed (or not) by a given allocation. In particular (and we've implemented this, as a specific outcome of aggressively applying a general-purpose dead code eliminator) if you allocate an object that has no constructors (or whose constructors are all inlined and found to be empty/useless), no finalizers (*), and do not make subsequent use of the object, it can be "collected" at compile-time. Ask yourself, how would you write a program that could detect this without externally observing the heap size? And, if you cannot detect it, then it has no bearing on whether the implementation does or not does not conform to the spec, and it surely does not break WORA. (*) The finalizer could be inlined, but that is special-purpose and probably a little silly. David Chase chase@xxxxxxxxxxxxxxxxx --- To unsubscribe, mail advanced-java-unsubscribe@xxxxxxxxxxxxxxxx To get help, mail advanced-java-help@xxxxxxxxxxxxxxxx
- References:
- Garbage Collector question?
- From: Shrihari.S.C
- Garbage Collector question?
- From: David Soroko
- Garbage Collector question?
- Prev by Date: Application hanging at start-up
- Next by Date: Swing Character Support above 127
- Previous by thread: Garbage Collector question?
- Next by thread: Garbage Collector question?
- Index(es):