Garbage Collection, GC

Tags:

* GC Characteristics
– Partial vs full collection
– Stop the world vs concurrent: App 와 GC간에
– Serial vs Parallel: GC자체에 대해

* XX:+UseParallelGC
young이 frequent 하기 때문에 young generation에만 적용됨.
old는 항상 serial
default 는 serial

* XX:+UseConcMarkSweepGC
Old를 concurrent로 mark and sweep
Young은 CPU가 available하면 자동으로 concurrent
default는 stop the world

* tuning guide
http://java.sun.com/docs/hotspot

* Object pool
– allication이 serialized됨. (반면 현재의 컬렉터는 parallel지원)
– data is artificially alive-> GC에 압박
– 정말 allocation이 비쌀때만 사용해야(DB사용한 초기화등)
– object pool이 작아지지 않는 형태면, 다른 라이브러리를 GC하게됨
– GC는 적게 일어나면서 더 많은 용량을 책임지게됨.

* Avoid finalization
– 생성시 시간이 듦(fianlizer에 등록)
– resurrection(또는 new)시키면 또 GC해야함

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *