- 1. $BA0CV$-(B
- 2. HotSpot VM 1.4.x $B$N(B GC $B$N
- 3. Mostly-concurrent Mark & Sweep
- 4. $B1~MQ(B
- 5. $B;29MJ88%(B
- $B5SCm(B
- $B%3%a%s%H(B
1. $BGX7J(B
$B%,!<%Y!<%8%3%l%/%7%g%s(B(GC) $B$K$O?'!9$J%"%k%4%j%:%`$,B8:_$9$k$,!"Bg;(GD$K8@$C$F(B Stop-the-World (STW) $B7?(B GC $B$H(B On-the-fly $B7?(B GC $B$KBgJL$5$l$k!#(B
STW $B7?$N(B GC $B$O%W%m%0%i%`$N
$B0lJ}!"(BOn-the-fly $B7?(B GC $B$O%W%m%0%i%`$N
$B$3$NOC$rJ9$/$H!"(BGC $B$NJ}<0$H$7$F$O(B On-the-fly $B7?(B GC $B$NJ}$,(B STW $B7?(B GC $B$h$jM%$l$F$$$k$h$&$KJ9$3$($k$,!"$=$&$OLd20$,2<$m$5$J$$!#(B
$B0lHL$K(B GC $B$rA*$V;XI8$H$7$F$O(B$B%9%k!<%W%C%H(B(throughput)$B@-G=(B$B$H(B$B%l%9%]%s%9(B(response)$B@-G=(B$B$N(B 2 $B$D$,$"$k!#(B
On-the-fly $B7?(B GC $B$O(BGC $B$K$h$kDd;_$,$J$$$N$G%l%9%]%s%9@-G=$OHs>o$K$h$$!#(B
$B$@$,!"(BOn-the-fly $B7?(B GC $B$r
$B0lJ}!"(BSTW $B7?(B GC $B$O!V(BGC $B$K$h$kDd;_;~4V!W$r64$`I,MW$,$"$k$N$@$,!"(BGC $B$r
$B$7$+$7!":G6a$N(B Java $B%7%9%F%`$G$O:F$S%l%$%F%s%7@-G=$,=E;k$5$l$k$h$&$K$J$j$D$D$"$k!#(B
$B%a%b%j$NDc2A3J!&BgMFNL2=!"(B64 $B%S%C%H%W%m%;%C%5$NIa5Z$KH<$C$F(B JavaVM $B$,;H$($k!&;H$&%a%b%jNL$OA}Bg$7$F$$$k!#(B
STW $B7?(B GC $B%"%k%4%j%:%`$NB?$/$O!"(BGC $B$,4IM}$7$F$$$k%a%b%jNL!"@8B8$7$F$$$k%*%V%8%'%/%H$N8D?t!"@8B8$7$F$$$k%*%V%8%'%/%H$N;2>H?t$N$$$:$l$+$KHfNc$9$k$?$a!"(BGC $BDd;_;~4V$,$I$s$I$s?-$S$k798~$,$"$k$N$G$"$k!#(B
$B%.%,%P%$%H$r1[$($k$h$&$J%a%b%j$r;HMQ$7$?>l9g!"(BGC $B$K$h$kDd;_;~4V$,(B 10 $BIC$r1[$($k$h$&$J%Q%?!<%s$N8=$l$F$$$k!#(B
$B$=$N$?$a%9%k!<%W%C%H@-G=$H%l%$%F%s%7@-G=$rN>N)$5$;$k$h$&$J(B GC $B%"%k%4%j%:%`$,I,MW$K$J$k!#(B
$B0J2Mostly Concurrent GC
2. HotSpot VM 1.4.x $B$N(B GC $B$N
($B$3$N>O$O!"JL$NJ8=q$+$i$N@Z$jD%$j$J$N$G<}$^$j$,0-$$$,(B $B5$$K$7$J$$$G!#(B)
Sun $B$N(B Java2SE JDK $B$N(B JavaVM $B$OJ#?t$N%,!<%Y!<%8%3%l%/%7%g%s(B (GC) $B%"%k%4%j%:%`$,
Sun HotSpot VM 1.4.2 $B$+$i$O0J2<$N$h$&$J;XDj$,2DG=$G$"$k!#(B
$B$3$N%Z!<%8$G$O?7$7$$%3%s%+%l%s%H(B GC $B$N%"%k%4%j%:%`$r@bL@$9$k!#(B
HotSpot VM 1.4.x $B$,:NMQ$7$?%3%s%+%l%s%H(B GC $B$O(B Mostly-concurrent Mark & Sweep $B$G$"$k!#(B
$B$3$N%"%k%4%j%:%`$O!"(BHans-J. Boehm$B!"(BAlan J. Demers$B!"(BScott Shenker $B$N(B 3 $B?M$,(B 1991 $BG/$KH/I=$7$?(B[1] Mostly Parallel Garbage Collection (PLDI 1991) $B$r%Y!<%9$K(B Tony Printezis $B$H(B David Detlefs $B$,BgI}$K2~NI$7$?(B[2] A Generational Mostly-concurrent Garbage Collection (ISMM 2000) $B$G$"$k!#(B
$B0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%I$,%S%C%HA`:n$r9T$&$K$O!"%"%H%_%C%/L?Na$,I,MW$J$N$@!#(B
$B$3$l$r7Z8:$9$k$?$a$K$O$$$/$D$+$N:GE,2=$r9T$&!#(B
M-CMS $B$r4^$`(B Mark & Sweep $B$O!"(B
$B@8$-$F$$$k%*%V%8%'%/%H$r;D$7$F%,!<%Y!<%8$H$J$C$?%*%V%8%'%/%H$r2rJ|$7$F$$$/$N$G!"(B
$B2rJ|$5$l$?%9%Z!<%9(B($B%U%j!<%9%Z!<%9(B)$B$OO"B3$7$?6u4V$K$O$J$i$:!"(B
$B%R!<%W6u4V$,Cn?)$$>uBV$K$J$C$F$$$/!#(B
$B%U%i%0%a%s%F!<%7%g%s2=$G$"$k!#(B
$B$3$l$r2sHr$9$k$?$a$K$O!"(B
$B@8$-$F$$$k%*%V%8%'%/%H$N0LCV$r$:$i$7$F0l2U=j$K4s$;$kA`:n!"%3%s%Q%/%7%g%s(B(Compaction)$B$,I,MW$K$J$k!#(B
$B%3%s%Q%/%7%g%s7?(B GC $B$NBeI=$O(B Mark & Compact $B$G!"(B
Mark & Sweep $B$N(B sweep phase $B$r(B compaction phase $B$KCV$-49$($?$b$N$@!#(B
$B$?$@%9%$!<%W$,(B Java $B%9%l%C%I$H%3%s%+%l%s%H$K=hM}$G$-$k$N$H0c$$!"(B
$B%3%s%Q%/%7%g%s$O:G=i$+$i:G8e$^$G(B Java VM $B$rDd;_$5$;$?>e$G9T$o$J$$$H%@%a!#(B
$B%*%V%8%'%/%H$N;2>H$N4X78@-$K$b$h$k$,!"(B
marking phase $B$H(B compaction phase $B$O$@$$$?$$F1DxEY$N;~4V$,$+$+$k$N$G!"(B
marking $B$,(B concurrent $B$K$J$C$?$@$1$G$O(B GC $BDd;_;~4V$OH>J,DxEY$K$7$+$J$i$J$$!#(B
$B$3$l$G$O$"$^$j8z2L$,$J$$!#(B
[3] $B$GDs0F$5$l$F$$$k(B Incremental Compaction $B$O(B M-CMS $B$NH/E87O$G$"$k!#(B
$B%R!<%WA4BN$r%3%s%Q%/%7%g%s$OD|$a!"(B
$B%R!<%W6u4V$N0lIt$K%3%s%Q%/%7%g%sMQ$NAk(B(Evacuated Area; EA $B$H8F$V$3$H$K$9$k(B) $B$r@_$1$k!#(B
M-CMS $B$K$h$C$FAk0J30$NItJ,$O%9%$!<%W$r9T$$(B
GC $B $B%*%W%7%g%s(B
$B798~!&E,@5(B
$B@bL@(B
$B%N!<%^%k(B
$BL5;XDj(B
$B4pK\(B
Copying GC $B$H(B Mark & Compact $B$rAH$_9g$o$;$?@$BeJL(B(Generational) GC$B!#(B
$B$3$l$,4pK\$K$J$k!#(B
$B%Q%i%l%k(B GC
-XX:+UseParallelGC
$B%5!<%P!
$B%9%k!<%W%C%H=E;k(B
$B%N!<%^%k$HF1MM$N@$BeJL(B GC $B$@$,!"(B
$B?7@$BeB&$N(B Copying GC $B$r(B
Parallel Copying GC $B$KCV$-49$($?$b$N!#(B
Minor GC (1$B2s$N=hM};~4V$,C;$/!"H/@8IQEYB?(B)$B!"(B
Major GC (1$B2s$N=hM};~4V$,D9$/!"H/@8IQEY>.(B) $B$N$&$A(B
Minor GC $B$,(B JavaVM $B$rDd;_$9$k;~4V$,C;=L$5$l
$B%3%s%+%l%s%H(B GC
-Xconcgc
$B%5!<%P!
$B%l%9%]%s%9=E;k(B
$B@$BeJL(B GC $B$@$,!"(B
$B5l@$BeB&$r(B Mostly-concurrent Mark & Sweep $B%"%k%4%j%:%`$rCV$-49$($?$b$N!#(B
Major GC $B$,(B JavaVM $B$rDd;_$9$k;~4V$rC;=L$9$k$N$G!"(B
$B%l%9%]%s%9%?%$%`$N:G0-CM$r2~A1$G$-$k!#(B
$BDI2C$N%*%W%7%g%s(B -XX:+UseParNew $B$r;XDj$9$k$3$H$G!"(B
-XX:+UseParallelGC $B$HF1MM$NJBNs(B GC $B$r(B
$B;HMQ$9$k$3$H$b$G$-$k!#(B
$B$3$N>l9g!"%9%k!<%W%C%H@-G=$b2~A1$5$l$k!#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%C%/$9$k$?$a$KJL
object2 $B$,(B null $B$G$J$$>l9g$O!"$I$s$J%*%V%8%'%/%H$G$b%A%'%C%/$r9T$&!#(B
void method( Class1 object, Class2 object2 ){
object1.field = object2;
}
$B%3%s%+%l%s%H%^!<%-%s%0$N8e=hM}(B
$B%9%$!<%T%s%0%U%'!<%:(B (Sweeping Phase)
$B$3$NA`:n$O%3%s%+%l%s%H$K9T$&$3$H$,$G$-$k$N$@$,!"(B
$B%m%C%/A`:n$N7Z8:$N$?$a$K(B
Sun HotSpot VM 1.4.x $B$G$O%3%s%+%l%s%H$K9T$C$F$$$J$$$O$:!#(B
Sun HotSpot 1.4.2 $B0J9_$N(B M-CMS $B$O%9%$!<%T%s%0!&%U%'%$%:$r(B
$B%3%s%+%l%s%H$K9T$C$F$$$k!#(B
4. $B1~MQ(B
4.1 $B@$BeJL(B GC $B$H$NAH$_9g$o$;(B
4.2 $B%+!<%I%^!<%-%s%0(B (Card Marking)
putfield
$B!"(Bputstatic
$B!"(Baastore
$B$J$I$N(B
$B%P%$%H%3!<%IL?Na$r
#define CARD_SIZE 512
#define DIRTY_MASK ((unsigned char)-1)
/* $B%+!<%I%F!<%V%k(B */
unsigned char card_marking_table[CARD_SIZE];
void write_barrier(Object* object) {
int offset = ((intptr_t)object) / CARD_SIZE;
card_marking_table = DIRTY_MASK;
}
unsigned char
(8 $B%S%C%H(B) $B$G9=@.$9$k$H$A$g$C$HL5BL$K$h$&$K;W$($k$,!"(B
$B$[$H$s$I$N(B CPU $B$G(B1$B%P%$%H$NFI$_=q$-$OIT2DJ,$K$J$k$N$G%"%H%_%C%/L?Na$d%m%C%/A`:n$,ITMW$K$J$k!#(B
$B$^$?(B M-CMS $B$N(B GC $B%"%k%4%j%:%`$N9bB.2=$r9T$C$F$$$k$H!"(B
1$B$D$N%+!<%I$KBP$7$FJ#?t$N%Q%i%a!<%?$r;}$?$;$?$/$J$k$N$G(B
$B>/$7I}$,$"$C$F$b$A$g$&$INI$$!#(B
4.3 $BJBNs2=(B (Parallel GC)
4.4 $B%S%C%H%o%$%:!&%9%$!<%W(B (Bitwise Sweep)
4.5 $B%$%s%/%j%a%s%?%k!&%3%s%Q%/%7%g%s(B (Incremental Compaction)