| Author |
Garbage Collection Implemention Questions
|
Edward Chen
Ranch Hand
Joined: Dec 23, 2003
Posts: 758
|
|
Henry Wong wrote:
A copy collector splits the heap in half and move objects between the two halves during the GC cycle. And yes, "it will cost a lot".
The theory behind using a copy collector for the new generation objects, is that most objects do not last very long.
We divide objects into young generation and tenured generation. Question is, how to divide ? Yes, the object defined inside a method definitely is short lived, should be in young generation. My coding above is not this case, so local object is not our topic here.
Objects defined in the instance level, how to divide them into young generation and tenured generation ?
Thanks.
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16815
|
|
I think it would be a good idea to start a new topic... In fact, let me start one for you.... DONE.
This topic has been spun off from here... http://www.coderanch.com/t/520071/java/java/detect-memory-leak
Henry
|
Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
|
 |
Henry Wong
author
Sheriff
Joined: Sep 28, 2004
Posts: 16815
|
|
All objects, that are instantiated on the heap, goes to the new generation portion of the heap. After a few new generation GC cycles, depending on configuration, they should be promoted to the old generation portion of the heap.
Now, if you want to know how the GC is configured, then you should google for a java GC tuning guide.
Henry
|
 |
 |
|
|
subject: Garbage Collection Implemention Questions
|
|
|