Firefoxã®GCã¾ãã
ãªãã¨ãªãã¡ãã£ã¨ã ãèªãã§ã¿ããFirefoxã«ããã¦ãJSã使ãã¡ã¢ãªã¯ã³ã³ãã¼ãã¡ã³ãããã£ã³ã¯ãã¢ãªã¼ãã®é ã«åè§£ããããã³ã³ãã¼ãã¡ã³ããã©ããä¸çªå¤§ããªåºåãããããé常ã¯ãã®åä½ã§GCãå¼ã°ãããã³ã³ãã¼ãã¡ã³ãã¯ãã¹ãåä½ã§ç¢ºä¿ããããããããã£ã³ã¯ã¯ç¹ã«ç¹å¾´ã®ãªãå¡ã§ãã¢ãªã¼ãã¯åæ¯ã«ä½ãããã
GCã¯Full GCã¨ã³ã³ãã¼ãã¡ã³ãGCããããå¾è ã§ã¯ã³ã³ãã¼ãã¡ã³ãåä½ã§GCãè¡ããããTriggerGCãå¼ã°ããã¨Full GCãå®è¡ãããTriggerCompartmentGCãå¼ã°ããã¨Compartment GCãå®è¡ããããTriggerGCãå¼ãã§ããã¨ããã¯grepããéãã§ã¯AllocateArenaã¨TriggerCompartmentGCã®2ã¤ã ãã§ãAllocateArenaã¯PickChunkã«å¤±æããã¨ãã«ã ãå¼ã¶ãTriggerCompartmentGCå ã§ã¯ä»¥ä¸ã®ãããªæ¡ä»¶ã§å¼ã³åºãã¦ããã
if (rt->gcBytes > 8192 && rt->gcBytes >= 3 * (rt->gcTriggerBytes / 2)) {
/* If we're using significantly more than our quota, do a full GC. */
TriggerGC(rt);
return;
}ã¤ã¾ãããã«GCã¯ã¡ã¢ãªã確ä¿ã§ããªãæãããããããè¨å®ããã以ä¸ã®å®¹éã使ã£ã¦ããå ´åã«è¡ãããã
䏿¹ãTriggerCompartmentGCã¯Chunk::allocateArenaããå¼ã°ããããã®éã®æ¡ä»¶ã¯ä»¥ä¸ã®ããã«ãªã£ã¦ããã
if (comp->gcBytes >= comp->gcTriggerBytes)
TriggerCompartmentGC(comp);gcBytesã¯Arenaãallocateããåã ãå¢ããã®ã§ãããããã¯ããããããè¨å®ããããã以ä¸ã®å®¹éã®ã¡ã¢ãªã使ã£ã¦ããå ´åã«GCãå¼ã°ãããã¨ããæ¡ä»¶ã§ããã
ç¹ã«ã¾ã¨ãã¨ãã¯ãªãããGCãè¡ãããã®ã¯ã¡ã¢ãªããããã«allocateãããã¨ããæã§ãããã¨è¨ãããã ã