dz̸PHP5ÖÐÀ¬»ø»ØÊÕËã·¨(Garbage Collection)µÄÑÝ»¯(3)
PHP5.3ÖеÄÀ¬»ø»ØÊÕËã·¨¡ª¡ªConcurrent Cycle Collection in Reference Counted Systems
PHP5.3µÄÀ¬»ø»ØÊÕËã·¨ÈÔÈ»ÒÔÒýÓüÆÊýΪ»ù´¡£¬µ«ÊDz»ÔÙÊÇʹÓüòµ¥¼ÆÊý×÷Ϊ»ØÊÕ×¼Ôò£¬¶øÊÇʹÓÃÁËÒ»ÖÖͬ²½»ØÊÕËã·¨£¬Õâ¸öËã·¨ÓÉIBMµÄ¹¤³ÌʦÔÚÂÛÎÄConcurrent Cycle Collection in Reference Counted SystemsÖÐÌá³ö¡£
Õâ¸öËã·¨¿ÉνÏ൱¸´ÔÓ£¬´ÓÂÛÎÄ29Ò³µÄÊýÁ¿ÎÒÏë´ó¼ÒÒ²ÄÜ¿´³öÀ´£¬ËùÒÔÎÒ²»´òË㣨ҲûÓÐÄÜÁ¦£©ÍêÕûÂÛÊö´ËËã·¨£¬ÓÐÐËȤµÄÅóÓÑ¿ÉÒÔÔĶÁÉÏÃæµÄÌáµ½µÄÂÛÎÄ£¨Ç¿ÁÒÍƼö£¬ÕâƪÂÛÎķdz£¾«²Ê£©¡£
ÎÒÔÚÕâÀֻÄÜ´óÌåÃèÊöһϴËËã·¨µÄ»ù±¾Ë¼Ïë¡£
Ê×ÏÈPHP»á·ÖÅäÒ»¸ö¹Ì¶¨´óСµÄ¡°¸ù»º³åÇø¡±£¬Õâ¸ö»º³åÇøÓÃÓÚ´æ·Å¹Ì¶¨ÊýÁ¿µÄzval£¬Õâ¸öÊýÁ¿Ä¬ÈÏÊÇ10,000£¬Èç¹ûÐèÒªÐÞ¸ÄÔòÐèÒªÐÞ¸ÄÔ´´úÂëZend/zend_gc.cÖеij£Á¿GC_ROOT_BUFFER_MAX_ENTRIESÈ»ºóÖØбàÒë¡£
ÓÉÉÏÎÄÎÒÃÇ¿ÉÒÔÖªµÀ£¬Ò»¸özvalÈç¹ûÓÐÒýÓã¬ÒªÃ´±»È«¾Ö·ûºÅ±íÖеķûºÅÒýÓã¬ÒªÃ´±»ÆäËü±íʾ¸´ÔÓÀàÐ͵ÄzvalÖеķûºÅÒýÓá£Òò´ËÔÚzvalÖдæ ÔÚһЩ¿ÉÄܸù£¨root£©¡£ÕâÀïÎÒÃÇÔÝÇÒ²»ÌÖÂÛPHPÊÇÈçºÎ·¢ÏÖÕâЩ¿ÉÄܸùµÄ£¬ÕâÊǸöºÜ¸´ÔÓµÄÎÊÌ⣬×ÜÖ®PHPÓа취·¢ÏÖÕâЩ¿ÉÄܸùzval²¢½«ËüÃÇͶÈë ¸ù»º³åÇø¡£
µ±¸ù»º³åÇøÂú¶îʱ£¬PHP¾Í»áÖ´ÐÐÀ¬»ø»ØÊÕ£¬´Ë»ØÊÕËã·¨ÈçÏ£º
1¡¢¶Ôÿ¸ö¸ù»º³åÇøÖеĸùzval°´ÕÕÉî¶ÈÓÅÏȱéÀúËã·¨±éÀúËùÓÐÄܱéÀúµ½µÄzval£¬²¢½«Ã¿¸özvalµÄrefcount¼õ1£¬Í¬Ê±ÎªÁ˱ÜÃâ¶Ôͬһzval¶à´Î¼õ1£¨ÒòΪ¿ÉÄܲ»Í¬µÄ¸ùÄܱéÀúµ½Í¬Ò»¸özval£©£¬Ã¿´Î¶Ôij¸özval¼õ1ºó¾Í¶ÔÆä±ê¼ÇΪ¡°ÒѼõ¡±¡£
2¡¢ÔٴζÔÿ¸ö»º³åÇøÖеĸùzvalÉî¶ÈÓÅÏȱéÀú£¬Èç¹ûij¸özvalµÄrefcount²»Îª0£¬Ôò¶ÔÆä¼Ó1£¬·ñÔò±£³ÖÆäΪ0¡£
3¡¢Çå¿Õ¸ù»º³åÇøÖеÄËùÓиù£¨×¢ÒâÊÇ°ÑÕâЩzval´Ó»º³åÇøÖÐÇå³ý¶ø²»ÊÇÏú»ÙËüÃÇ£©£¬È»ºóÏú»ÙËùÓÐrefcountΪ0µÄzval£¬²¢ÊÕ»ØÆäÄÚ´æ¡£
Èç¹û²»ÄÜÍêÈ«Àí½âҲûÓйØϵ£¬Ö»Ðè¼ÇסPHP5.3µÄÀ¬»ø»ØÊÕËã·¨ÓÐÒÔϼ¸µãÌØÐÔ£º
1¡¢²¢²»ÊÇÿ´Îrefcount¼õÉÙʱ¶¼½øÈë»ØÊÕÖÜÆÚ£¬Ö»Óиù»º³åÇøÂú¶îºóÔÚ¿ªÊ¼À¬»ø»ØÊÕ¡£
2¡¢¿ÉÒÔ½â¾öÑ»·ÒýÓÃÎÊÌâ¡£
3¡¢¿ÉÒÔ×ܽ«ÄÚ´æ鶱£³ÖÔÚÒ»¸öãÐÖµÒÔÏ¡£
PHP5.2ÓëPHP5.3À¬»ø»ØÊÕËã·¨µÄÐÔÄܱȽÏ
ÓÉÓÚÎÒÄ¿Ç°Ìõ¼þËùÏÞ£¬ÎҾͲ»ÖØÐÂÉè¼ÆÊÔÑéÁË£¬¶øÊÇÖ±½ÓÒýÓÃPHP ManualÖеÄʵÑ飬¹ØÓÚÁ½ÕßµÄÐÔÄܱȽÏÇë²Î¿¼PHP ManualÖеÄÏà¹ØÕ½ڣºhttp://www.php.net/manual/en/features.gc.performance-considerations.php¡£
Ê×ÏÈÊÇÄÚ´æй¶ÊÔÑ飬ÏÂÃæÖ±½ÓÒýÓÃPHP ManualÖеÄʵÑé´úÂëºÍÊÔÑé½á¹ûͼ£º
<?php class Foo { public $var = '3.1415962654'; } $baseMemory = memory_get_usage(); for ( $i = 0; $i <= 100000; $i++ ) { $a = new Foo; $a->self = $a; if ( $i % 500 === 0 ) { echo sprintf( '
ÍƼöÐÅÏ¢
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- php³£ÓÃÕýÔò±í´ïʽ
- phpÐÔÄܼà²âÄ£¿éXHProf
- ÈÃCI¿ò¼ÜÖ§³Öservice²ã
- ʹÓÃPHPÉú³É´øLOGOµÄ¸öÐÔ»¯¶þάÂëͼÏñ
- ¹ØÓÚCodeIgniterÄã¿ÉÄܲ»ÖªµÀµÄ5¸ö֪ʶµã
- Memcache ºÁÃ뼶³¬Ê±¼°ÆäËû³£¼ûÎÊÌâ»ã×Ü
- [PHP±Ê¼Ç]PHPQueryÒ»¸ö´¦ÀíDOMµÄÀûÆ÷
ÈÈÃÅÐÅÏ¢
- nohup: redirecting stderr to stdou....
- ʹÓÃlog_formatΪNginx·þÎñÆ÷ÉèÖøüÏêϸµÄÈÕÖ¾¸ñʽ
- jquery easyUI--dataGrid-Json
- [Ô´´]·ÂGoogle Reader¡¢ÐÂÀË΢²©¡¢ÌÚѶ΢²©µ....
- ÀûÓÃKeepalived+mysql¹¹½¨¸ß¿ÉÓÃMySQLË«Ö÷×Ô¶....
- Nginx+keepalivedʵÏÖ¸ºÔؾùºâºÍË«»úÈȱ¸¸ß¿ÉÓÃ
- jqueryʵÏÖÒ³Ãæ¼ÓÔؽø¶ÈÌõ
- Rolling cURL: PHP²¢·¢×î¼Ñʵ¼ù
- codeigniter ·ÓÉÖÕ¼«ÓÅ»¯(url rewrite)
- linuxÏÂÉèÖÃsshÎÞÃÜÂëµÇ¼
×î½ü¸üÐÂ
- PHP»ñÈ¡Óû§µÄÕæʵIP£¬²¢ÅжÏÊÇ·ñÄÚÍøIP
- PHP ´íÎóÈÕÖ¾ error_log
- ÀûÓÃbigpipe»úÖÆʵÏÖÒ³ÃæÄ£¿éµÄÒì²½äÖȾ chunked¼¼Êõ
- php¿ØÖÆÎļþÏÂÔØËÙ¶È
- js + php ¶ÁÈ¡¡¢²¥·ÅÊÓƵÁ÷ ¼æÈÝfirefox£¬c....
- ¡¾ÊÓƵ²¥·Å¡¿JplayerÊÓƵ²¥·ÅÆ÷µÄʹÓÃ
- UNICODE Óë UTF-8 µÄ¹Øϵ
- memcacheÄÚ´æÔÀí
- Memcache¼¼Êõ·ÖÏí£º½éÉÜ¡¢Ê¹Óᢴ洢¡¢Ëã·¨¡¢ÓÅ»¯....
- phpʹÓÃmb_detect_encoding¼ì²â×Ö·û´®±àÂë
ÆÀÂÛ