| Author |
GC
|
Ricardo Gil
Greenhorn
Joined: Aug 06, 2001
Posts: 14
|
|
"You can't force the garbage collection." Why it�s true according with WhizLabs exam if exists System.gc() ???
|
** SCJP1.4 **
|
 |
Sarma Lolla
Ranch Hand
Joined: Oct 21, 2002
Posts: 203
|
|
Because you can only request. Please note that system.gc() is only a recommendation and there is no guarantee that this will be executed.
|
 |
Michael Ernest
High Plains Drifter
Sheriff
Joined: Oct 25, 2000
Posts: 7292
|
|
Hi ricardogil - Please take a second to review our naming policy. We'd appreciate it if you could change your screen name to match policy. Simply put, System.gc() does not encapsulate a set of instructions that force the system to scope memory and clear out old stuff when it is called. It is more like an advice. By calling System.gc(), the programmer is trying to hint to the VM that it's a good time -- from the program's perspective, anyway -- to clear out and restore memory. There is an underlying software technique that Doug Lea calls "early release" in one of his books. It boils down to providing a method that returns right away but schedules or delays the underlying action. [ January 03, 2003: Message edited by: Michael Ernest ]
|
Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
|
 |
 |
|
|
subject: GC
|
|
|