ã¡ã¢ãªç®¡çã¯ããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®äžå¿çãªåŽé¢ã§ãã ããã¯ãããã°ã©ãã³ã°ãšã·ã¹ãã 管çã«åºæ¬çãªåœ±é¿ãåãŒããŸãã 次ã®ããã€ãã®æçš¿ã§ã¯ãèšæ¶ã®ä»äºã«é¢é£ããåé¡ã«è§ŠããŸãã å®çšé¢ã«éç¹ã眮ãããŸãããå
éšããã€ã¹ã®è©³çŽ°ã¯ç¡èŠããŸããã æ€èšäžã®æŠå¿µã¯éåžžã«äžè¬çã§ãããäž»ã«x86-32ã³ã³ãã¥ãŒã¿ãŒã§å®è¡ãããŠããLinuxããã³Windowsã®äŸã§èª¬æãããŠããŸãã æåã®æçš¿ã§ã¯ããŠãŒã¶ãŒããã»ã¹ã®ã¡ã¢ãªæ§æã«ã€ããŠèª¬æããŸãã
ãã«ãã¿ã¹ã¯OSã®åããã»ã¹ã¯ãç¬èªã®ãµã³ãããã¯ã¹ã§å®è¡ãããŸãã ãã®ãµã³ãããã¯ã¹ã¯ã32ãããä¿è·ã¢ãŒãã§ã¯
åžžã«4ã®ã¬ãã€ãã®ãµã€ãºãæ〠仮æ³ã¢ãã¬ã¹ç©ºéã§ãã ä»®æ³ç©ºéãšç©çã¡ã¢ãªã®å¯Ÿå¿ã¯ã
ããŒãžããŒãã«ã䜿çšããŠèšè¿°ãã
ãŸã ã ã«ãŒãã«ã¯ããŒãã«ãäœæããŠããŒã¿ãèšå®ããå¿
èŠã«å¿ããŠããã»ããµãã¢ãã¬ã¹ã«å€æããããã«ããŒãã«ã«ã¢ã¯ã»ã¹ããŸãã åããã»ã¹ã¯ãç¬èªã®ããŒãã«ã»ããã§åäœããŸãã éèŠãªç¹ã1ã€ãããŸããä»®æ³ã¢ãã¬ã¹æå®ã®æŠå¿µã¯
ãã«ãŒãã«èªäœãå«ã å®è¡äžã®ãã¹ãŠã®ãœãããŠã§ã¢ã«æ¡åŒµã
ã ãŸã ã ãã®ãããä»®æ³ã¢ãã¬ã¹ç©ºéã®äžéšïŒããããã«ãŒãã«ç©ºéïŒã¯äºçŽãããŠããŸãã
ãã¡ãããããã¯ãã«ãŒãã«ããã®ãã¹ãŠã®ã¹ããŒã¹ãå æ
ããããšã
æå³ãããã®ã§
ã¯ãªã ããã®ã¢ãã¬ã¹ã®ç¯å²ã ãã䜿çšããŠãã«ãŒãã«ãéžæããç©çã¢ãã¬ã¹ã¹ããŒã¹ã®ä»»æã®éšåããããã³ã°ã§ããŸãã ã«ãŒãã«ã¹ããŒã¹ã«å¯Ÿå¿ããã¡ã¢ãªããŒãžã¯ãããŒãžããŒãã«ã§
ç¹æš©ã³ãŒã ïŒãªã³ã°2以äžã®ç¹æš©ïŒå°çšã«äœ¿çšå¯èœãšããŠããŒã¯ãããŸãã ãŠãŒã¶ãŒã¢ãŒãã³ãŒããããããã®ããŒãžã«ã¢ã¯ã»ã¹ããããšãããšãããŒãžãã©ãŒã«ããçæãããŸãã Linuxã®å Žåãã«ãŒãã«ã¹ããŒã¹ã¯åžžã«ããã»ã¹ã¡ã¢ãªã«ååšããç°ãªãããã»ã¹ã¯ã«ãŒãã«ã¹ããŒã¹ãç©çã¡ã¢ãªã®åãé åã«ãããããŸãã ãããã£ãŠãå²ã蟌ã¿ãŸãã¯ã·ã¹ãã ã³ãŒã«ãåŠçããå¿
èŠãããå Žåãã«ãŒãã«ã³ãŒããšããŒã¿ã¯åžžã«å©çšå¯èœã§ãã 察ç
§çã«ããŠãŒã¶ãŒã¢ãŒã空éã«ããããããã©ã³ãã ã¢ã¯ã»ã¹ã¡ã¢ãªã¯ãã³ã³ããã¹ããåãæ¿ãããã³ã«å€åããŸãã
å³ã®éè²ã¯ãç©çã¡ã¢ãªã»ã¯ã·ã§ã³ã«å¯Ÿå¿ããä»®æ³ã¢ãã¬ã¹ç©ºéã®é åã瀺ããŠããŸãã çœ-ãŸã 䜿çšãããŠããªãé åã ã芧ã®ãšãããFirefoxã¯ã»ãšãã©ã®ä»®æ³ã¢ãã¬ã¹ç©ºéã䜿çšããŸããã ç§ãã¡ã¯çãRAMã®èŠ³ç¹ãããã®ããã°ã©ã ã®äŒèª¬çãªå€§é£ãã«ã€ããŠç¥ã£ãŠããŸãã å³ã®éãããŒã¯ãããŒããã¹ã¿ãã¯ãªã©ã®ããã°ã©ã
ã¡ã¢ãªã»ã°ã¡ã³ãã§ãã ãã®å Žåãã»ã°ã¡ã³ãããšã«ãåã«é£ç¶ããã¢ãã¬ã¹ç¯å²ãæå³ããããšã«æ³šæããŠãã ããã ãããã¯
ãIntelããã»ããµã®ã»ã°ã¡ã³ããŒã·ã§ã³ã説æãããšãã«èª¬æ
ããã»ã°ã¡ã³ãã§ã¯ãã
ãŸãã ã äœããã®æ¹æ³ã§ãããã«Linuxã®æšæºããã»ã¹ã¡ã¢ãªæ§æã¹ããŒã ã瀺ããŸãã
ãããããããã³ã³ãã¥ãŒã¿ãŒæè¡ããŸã åæ段éã«ãã£ããšããã»ã°ã¡ã³ãã®åæä»®æ³ã¢ãã¬ã¹ã¯ããã·ã³ã«ãã£ãŠå®è¡ãããã»ãšãã©ãã¹ãŠã®ããã»ã¹ã§
ãŸã£ããåãã§ããã ãã®ããããªã¢ãŒãããã®è匱æ§ã®æªçšã¯å€§å¹
ã«ç°¡çŽ åãããŸãã ãšã¯ã¹ããã€ãã¯ãã¹ã¿ãã¯äžã®ã¢ãã¬ã¹ãã©ã€ãã©ãªé¢æ°ã®ã¢ãã¬ã¹ãªã©ã絶察ã¢ãã¬ã¹ã§ã¡ã¢ãªã«ã¢ã¯ã»ã¹ããå¿
èŠããããŸãã ãªã¢ãŒãæ»æãå®è¡ããããšããããã«ãŒã¯ãç°ãªããã·ã³ã®ã¡ã¢ãªå
ã®ããã°ã©ã ã»ã°ã¡ã³ãã®é
眮ãåäžã«ãªãããšãæåŸ
ããŠããã©ã€ã³ãã³ã³ã¿ã¯ãã®ã¢ãã¬ã¹ãéžæããå¿
èŠããããŸãã ãããŠããããæ¬åœã«åäžã§ããå Žåã人ã
ããããã³ã°ããããšãèµ·ãããŸãã ãã®ãããããã»ã¹ã®ã¢ãã¬ã¹ç©ºéå
ã®ã»ã°ã¡ã³ãã®äœçœ®ãã©ã³ãã åããã¡ã«ããºã ã人æ°ãéããŠããŸãã Linuxã¯ã
ã¹ã¿ã㯠ã
ã¡ã¢ãªãããã³ã°ã®ã»ã°ã¡ã³ã ãããã³
ããŒãã®äœçœ®ãã©ã³ãã åããŸããéå§ã¢ãã¬ã¹ã¯ããªãã»ãããè¿œå ããããšã§èšç®ãããŸãã æ®å¿µãªããã32ãããã®ã¹ããŒã¹ã¯ããã»ã©å€§ãããªããã©ã³ãã åã®å¹ç
ã¯ããçšåºŠå¹³æºåãããŠããŸãã
ãŠãŒã¶ãŒã¢ãŒãã¹ããŒã¹ã®äžçªäžã¯ãã¹ã¿ãã¯ã»ã°ã¡ã³ãã§ãã ã»ãšãã©ã®ããã°ã©ãã³ã°èšèªã¯ãé¢æ°ã«æž¡ãããããŒã«ã«å€æ°ãšåŒæ°ãä¿åããããã«ããã䜿çšããŸãã é¢æ°ãŸãã¯ã¡ãœãããåŒã³åºããšãããããã¹ã¿ãã¯ãçºçããŸã
ã¹ã¿ãã¯ãã¬ãŒã ã é¢æ°ãæ»ããšãã¹ã¿ãã¯ãã¬ãŒã ã¯ç Žæ£ãããŸãã ã¹ã¿ãã¯ã¯éåžžã«åçŽã§ããããŒã¿ã¯
ãæåŸã«æ¥ã人ãïŒLIFOïŒã®ååã«åŸã£ãŠåŠçãããŸãã ãã®ãããã¹ã¿ãã¯ã®å
容ãç£èŠããã«ã¯è€éãªå¶åŸ¡æ§é ã¯å¿
èŠãããŸãããã¹ã¿ãã¯ã®æäžéšãžã®ãã€ã³ã¿ã§ååã§ãã ã¹ã¿ãã¯ãžã®ããŒã¿ã®è¿œå ãšåé€ã¯ãçŽ æ©ãæ確ã«å®çŸ©ãããæäœã§ãã ããã«ãã¹ã¿ãã¯ã»ã°ã¡ã³ãã®åãé åãç¹°ãè¿ã䜿çšãããšãããããéåžž
ããã»ããµãã£ãã·ã¥ã«é
眮ããããšããäºå®ã«ã€ãªãããã¢ã¯ã»ã¹ãããã«é«éåãããŸãã ããã»ã¹å
ã®åã¹ã¬ããã¯ãç¬èªã®ã¹ã¿ãã¯ã§åäœããŸãã
ã¹ã¿ãã¯ã»ã°ã¡ã³ãã«å²ãåœãŠãããã¹ããŒã¹ããè¿œå ãããããŒã¿ãå容ã§ããªãå¯èœæ§ããããŸãã ãã®çµæãããŒãžãã©ãŒã«ããçæãããŸããããã¯ãLinuxã§ã¯
expand_stackïŒïŒé¢æ°ã«ãã£ãŠåŠçãããŸãã 次ã«ãå¥ã®é¢æ°
acct_stack_growthïŒïŒãåŒã³åºããŸãããã®é¢æ°ã¯ãã¹ã¿ãã¯ã»ã°ã¡ã³ããå¢ããæ©èœããã§ãã¯ããŸãã ã¹ã¿ãã¯ã»ã°ã¡ã³ãã®ãµã€ãºãRLIMIT_STACKå®æ°ïŒéåžžã¯8 MBïŒã®å€ããå°ããå Žåããµã€ãºã¯å€§ãããªããããã°ã©ã ã¯äœãèµ·ãããªãã£ãããã«å®è¡ãç¶ããŸãã ããã¯ãã¹ã¿ãã¯ã»ã°ã¡ã³ãã®ãµã€ãºãå¿
èŠã«å¿ããŠå¢å ããæšæºã®ã¡ã«ããºã ã§ãã ãã ããã¹ã¿ãã¯ã»ã°ã¡ã³ãã®æ倧蚱容ãµã€ãºã«éãããš
ãã¹ã¿ãã¯ãªãŒããŒãããŒãçºçããSegmentation Faultã·ã°ãã«ãããã°ã©ã ã«éä¿¡ãããŸãã ã¹ã¿ãã¯ã»ã°ã¡ã³ãã¯ãå¿
èŠã«å¿ããŠæ¡å€§ã§ããŸãããå«ãŸããã¹ã¿ãã¯æ§é ãå°ãããªã£ãŠãçž®å°ããããšã¯ãããŸããã é£éŠäºç®ãšåæ§ã«ãã¹ã¿ãã¯ã»ã°ã¡ã³ãã¯æé·ã®ã¿å¯èœã§ãã
ãããããããŠããªããã¡ã¢ãªé åã«ã¢ã¯ã»ã¹ããããšãæå¹ãªæäœãšã¿ãªãããšãã§ããã®ã¯ãåçãªã¹ã¿ãã¯ã®æé·
ã®ã¿ã§ãã ãã®ä»ã®ã¢ã¯ã»ã¹ã§ã¯ãããŒãžãã©ãŒã«ãã®åŸã«ã»ã°ã¡ã³ããŒã·ã§ã³ãã©ãŒã«ããçºçããŸãã 䜿çšãããäžéšã®é åã¯èªã¿åãå°çšãšããŠããŒã¯ãããŠããããããã«ã¢ã¯ã»ã¹ãããšã»ã°ã¡ã³ããŒã·ã§ã³ãã©ãŒã«ããçºçããŸãã
ã¹ã¿ãã¯ã®äžã«ã¯ãã¡ã¢ãªãããã³ã°çšã®ã»ã°ã¡ã³ãããããŸãã ã«ãŒãã«ã¯ãã®ã»ã°ã¡ã³ãã䜿çšããŠããã¡ã€ã«ã®å
容ããããïŒã¡ã¢ãªã«ãããïŒããŸãã ãã¹ãŠã®ã¢ããªã±ãŒã·ã§ã³ã¯ã
mmapïŒïŒã·ã¹ãã ã³ãŒã«ïŒ
mmapã³ãŒã«å®è£
ã®èª¬æãžã®ãªã³ã¯ ïŒãŸãã¯Windowsã®
CreateFileMappingïŒïŒ /
MapViewOfFileïŒïŒãä»ããŠãã®æ©èœã䜿çšã§ããŸãã ãã¡ã€ã«ã®ã¡ã¢ãªãžã®ãããã³ã°ã¯äŸ¿å©ã§é«æ§èœãªãã¡ã€ã«I / Oæ¹åŒã§ãããããšãã°åçã©ã€ãã©ãªãããŒãããããã«äœ¿çšãããŸãã
å¿åã¡ã¢ãªãããã³ã°ã®å¯èœæ§ããããŸãããã®çµæããã¡ã€ã«ããããã³ã°ãããªãé åãåŸããã代ããã«ããã°ã©ã ãåäœããããããçš®é¡ã®ããŒã¿ãé
眮ããããã«äœ¿çšãããŸãã Linuxã§
mallocïŒïŒã䜿çšããŠã¡ã¢ãªã®å€§ããªãããã¯ã®å²ãåœãŠãèŠæ±ãããšãæšæºCã©ã€ãã©ãªã¯ããŒãã«ã¡ã¢ãªãå²ãåœãŠã代ããã«ãå¿åãããã³ã°ã¡ã«ããºã ã䜿çšããŸãã ãã®å Žåãã倧ããšããèªã¯ãå®æ°MMAP_THRESHOLDã®å€ããã倧ãããã€ãåäœã®å€ãæå³ããŸãã ããã©ã«ãã§ã¯ããã®å€ã¯128 kBã§ããã
malloptïŒïŒãåŒã³åºããŠå¶åŸ¡ã§ããŸãã
ããŒããšããã°ã 次ã«ãããã»ã¹ã®ã¢ãã¬ã¹ç©ºéã®èª¬æã§èª¬æããŸãã ã¹ã¿ãã¯ãšåæ§ã«ãããŒãã¯ããã°ã©ã ã®å®è¡äžã«ã¡ã¢ãªãå²ãåœãŠãããã«äœ¿çšãããŸãã ã¹ã¿ãã¯ãšã¯ç°ãªããããŒãã«å²ãåœãŠãããã¡ã¢ãªã¯ããã®ã¡ã¢ãªã®å²ãåœãŠãåŒãèµ·ãããé¢æ°ãçµäºããåŸã«ä¿åãããŸãã ã»ãšãã©ã®èšèªã¯ãããŒãã¡ã¢ãªã³ã³ãããŒã«ãæäŸããŸãã ãããã£ãŠãã«ãŒãã«ãšèšèªã®ã©ã³ã¿ã€ã ãäžç·ã«ãªã£ãŠè¿œå ã¡ã¢ãªãåçã«å²ãåœãŠãŸãã Cã§ã¯ãããŒããæäœããããã®ã€ã³ã¿ãŒãã§ã€ã¹ã¯
é¢æ°ã®mallocïŒïŒãã¡ããªã§ãããCïŒã®ãããªã¬ããŒãžã³ã¬ã¯ã·ã§ã³ããµããŒãããèšèªã§ã¯ãã¡ã€ã³ã€ã³ã¿ãŒãã§ã€ã¹ã¯newæŒç®åã§ãã
çŸåšã®ããŒããµã€ãºã§èŠæ±ãããéã®ã¡ã¢ãªãå²ãåœãŠãããšãã§ããå Žåãã«ãŒãã«ã䜿çšããã«ã©ã³ã¿ã€ã ã®ã¿ã䜿çšããŠå²ãåœãŠãããšãã§ããŸãã ãã以å€ã®å ŽåãmallocïŒïŒé¢æ°ã¯
brkïŒïŒã·ã¹ãã ã³ãŒã«ã䜿çšããŠãå¿
èŠã«å¿ããŠããŒããå¢ãããŸãïŒ
brkã³ãŒã«å®è£
ã®èª¬æãžã®ãªã³ã¯ ïŒã ããŒãäžã®ã¡ã¢ãªã®ç®¡çã¯ãè€éãªã¢ã«ãŽãªãºã ã䜿çšããŠè§£æ±ºããã®ã¯
ç°¡åãªäœæ¥ã§ã¯ãã
ãŸããã ãããã®ã¢ã«ãŽãªãºã ã¯ãããã°ã©ã å
ã®äºæž¬äžå¯èœã§æ··chaãšããã¡ã¢ãªå²ãåœãŠãã¿ãŒã³ã®æ¡ä»¶ã§é«éãã€å¹ççã«éæããããåªããŠããŸãã åèŠæ±ãããŒãã«ã¡ã¢ãªãå²ãåœãŠãã®ã«ãããæéã¯ãåçã«ç°ãªãå ŽåããããŸãã ãã®åé¡ã解決ããããã«ããªã¢ã«ã¿ã€ã ã·ã¹ãã ã¯
ç¹æ®ãªã¡ã¢ãªã¢ãã±ãŒã¿ãŒã䜿çšã
ãŸã ã ããŒãã¯
æçåã®åœ±é¿ãåããŸããããã¯ãããšãã°æ¬¡ã®å³ã«ç€ºãããŠããŸãã
æåŸã«ãããã»ã¹ã¢ãã¬ã¹ç©ºéã®äžéšã«ããã»ã°ã¡ã³ããBSSãããŒã¿ã»ã°ã¡ã³ãïŒããŒã¿ã»ã°ã¡ã³ãïŒãããã³ã³ãŒãã»ã°ã¡ã³ãïŒããã¹ãã»ã°ã¡ã³ãïŒã«å°éããŸããã BSSãšããŒã¿ã»ã°ã¡ã³ãã¯ãCã®ãœãŒã¹ã³ãŒãã®éçå€æ°ã«å¯Ÿå¿ããããŒã¿ãæ ŒçŽããŸããéãã¯ãBSSãããœãŒã¹ã³ãŒãã§å€ãæ瀺çã«æå®ãããŠ
ããªãåæåãããŠ
ããªãå€æ°ã«å¯Ÿå¿ããããŒã¿ãæ ŒçŽããããšã§ãïŒ
å®éããªããžã§ã¯ãã¯ãå€æ°å®£èšãæ瀺çã«ãŒãå€ã瀺ããŠããããå€ãæåã«æå®ãããŠãããããªã³ã¯ããããã¡ã€ã«ã«ãŒã以å€ã®å€ãæã€åãå
±éæåãå«ãŸããŠããªã ã BSSã»ã°ã¡ã³ãã«ã¯å¿åã¡ã¢ãªãããã³ã°ã䜿çšãããŸãã ãã®ã»ã°ã¡ã³ãã«ãããããããã¡ã€ã«ã¯ãããŸããã CãœãŒã¹ãã¡ã€ã«ã§
int cntActiveUsersã䜿çšãããŠããå Žåã察å¿ãããªããžã§ã¯ãã®ã¹ããŒã¹ãBSSã«å²ãåœãŠãããŸãã
BSSãšã¯ç°ãªããããŒã¿ã»ã°ã¡ã³ãã«ã¯ããœãŒã¹ã³ãŒãã§ãŒã以å€ã®å€ã§åæåãããéçå€æ°ã®å®£èšã«å¯Ÿå¿ãããªããžã§ã¯ããæ ŒçŽãããŸãã ãã®ã¡ã¢ãªã»ã°ã¡ã³ãã¯
å¿åã§ã¯ãã
ãŸãã ãããã°ã©ã ã€ã¡ãŒãžã®äžéšãããã«ãããã³ã°ãããŸãã ãããã£ãŠã
éçint cntWorkerBees = 10ã䜿çšãããšã察å¿ãããªããžã§ã¯ãã®ã¹ããŒã¹ãããŒã¿ã»ã°ã¡ã³ãã«å²ãåœãŠãããå€10ãæ ŒçŽãããŸãããã¡ã€ã«ã¯ããŒã¿ã»ã°ã¡ã³ãã«è¡šç€ºãããŸãããããã¯ããããã§ãã
ããã©ã€ããŒããããã³ã°ãïŒãã©ã€ããŒãã¡ã¢ãªãããã³ã°ïŒ ã ããã¯ããã®ã»ã°ã¡ã³ãã§ã®ããŒã¿å€æŽã察å¿ãããã¡ã€ã«ã®å
容ã«åœ±é¿ããªãããšãæå³ããŸãã ããããå¿
èŠããããŸããããããªããšãã°ããŒãã«å€æ°ã«å€ãå²ãåœãŠããšããã£ã¹ã¯ã«ä¿åãããŠãããã¡ã€ã«ã®å
容ãå€æŽãããŠããŸããŸãã ãã®å Žåãããã¯ãŸã£ããå¿
èŠãããŸããïŒ
ãã€ã³ã¿ãŒã䜿çšãããšãç¶æ³ã¯ããå°ãè€éã«ãªããŸãã å³ã®äŸã§ã¯ã
gonzoå€æ°ã«å¯Ÿå¿ãã
ãªããžã§ã¯ãã®
å
容ïŒããã¯4ãã€ãã®ã¢ãã¬ã¹ã§ãïŒã¯ããŒã¿ã»ã°ã¡ã³ãã«ãããŸãã ãã ãããã€ã³ã¿ãŒã«ãã£ãŠåç
§ãããè¡ã¯ãããŒã¿ã»ã°ã¡ã³ãã«åé¡ãããŸããã æååã¯èªã¿åãå°çšã®
ã³ãŒãã»ã°ã¡ã³ãã«ããããã¹ãŠã®ã³ãŒããšãããšãã°æååãªãã©ã«ãªã©ã®äºçŽ°ãªããšãæ ŒçŽããŸãïŒ
å®éã«ã¯ãæååã¯.rodataã»ã¯ã·ã§ã³ã«æ ŒçŽãããå®è¡å¯èœã³ãŒããå«ãä»ã®ã»ã¯ã·ã§ã³ãšãšãã«ãã³ãŒããå®è¡/ããŒã¿ãèªã¿åãæš©éãæã€ã¡ã¢ãªã«ããŒããããã»ã°ã¡ã³ã-ãããã®ç¿»èš³ ã å®è¡å¯èœãã¡ã€ã«ã®äžéšãã³ãŒãã»ã°ã¡ã³ãã«ããããããŸãã ããã°ã©ã ãããã¹ãã»ã°ã¡ã³ãã«æžã蟌ãããšãããšãã»ã°ã¡ã³ããŒã·ã§ã³ãã©ãŒã«ããæ©èœããŸãã ããã«ããããbazhennyhããã€ã³ã¿ãŒãæ±ãããšãã§ããŸããããããã«å¯ŸåŠããæåã®æ¹æ³ã¯ãCããŸã£ãã䜿çšããªãããšã§ãã以äžã¯ãäŸããã®ã»ã°ã¡ã³ããšå€æ°ã瀺ãå³ã§ãã
/ proc / pid_of_process / mapsãã¡ã€ã«ã®å
容ãèªã¿åãããšã§ãããã»ã¹ã¡ã¢ãªé åãã©ã®ããã«äœ¿çšããããã確èªã§ããŸãã ã»ã°ã¡ã³ãèªäœã®å
容ã¯ç°ãªãé åã§æ§æãããŠããå Žåãããããšã«æ³šæããŠãã ããã ããšãã°ãã¡ã¢ãªãããã³ã°ã»ã°ã¡ã³ãã«ããããããåãã€ãããã¯ã©ã€ãã©ãªã«ã¯ç¬èªã®é åããããBSSããã³ã©ã€ãã©ãªå
ã®ããŒã¿ã»ã°ã¡ã³ãã®é åãéžæã§ããŸãã 次ã®æçš¿ã§ã¯ããå°åããšããèšèã®æå³ãæ£ç¢ºã«èª¬æããŸãã æã
ãããŒã¿+ BSS +ããŒããæå³ãããããŒã¿ã»ã°ã¡ã³ãããšèšã人ãããããšã«æ³šæããŠãã ããã
nmããã³
objdumpãŠãŒãã£ãªãã£ã䜿çšããŠããã€ããªå®è¡å¯èœã€ã¡ãŒãžã®å
容ïŒæåãã¢ãã¬ã¹ãã»ã°ã¡ã³ããªã©ïŒã衚瀺ã§ããŸãã æåŸã«ããã®æçš¿ã§èª¬æããã®ã¯ãããã»ã¹ã¡ã¢ãªã®ãããããæè»ãªãæ§æïŒæè»ãªã¡ã¢ãªã¬ã€ã¢ãŠãïŒã§ããããã¯ãLinuxã§æ°å¹Žåããããã©ã«ãã§äœ¿çšãããŠããŸãã ãã®ã¹ããŒã ã¯ãå®æ°RLIMIT_STACKã®å€ãå®çŸ©ããŠããããšãåæãšããŠããŸãã ããã§ãªãå ŽåãLinuxã¯ãããã å³ã«ç€ºãããŠããå€å
žçãªçµç¹ïŒ
ãŸããããã ãã§ãã ããã§ãããã»ã¹ã¡ã¢ãªã®æŽçã«ã€ããŠã®è©±ã¯çµããã§ãã 次ã®æçš¿ã§ã¯ãã«ãŒãã«ãèšè¿°ãããã¡ã¢ãªé åã®ãµã€ãºãã©ã®ããã«è¿œè·¡ããããæ€èšããŸãã ãŸãããããã³ã°ã®åé¡ããã¡ã€ã«ã®èªã¿åããšæžã蟌ã¿ãããã«é¢ä¿ããããšãã¡ã¢ãªã®äœ¿çšã説æããæ°åãæå³ããããšã«ã€ããŠã觊ããŸãã
ã¹ããŒããœãã瀟å¡ãäœæããè³æsmart-soft.ru