在php5.3之前,为某变量分配内存是用宏 MAKE_STD_ZVAL;
737 #define MAKE_STD_ZVAL(zv) # /Zend/zend.h
738 ALLOC_ZVAL(zv);
739 INIT_PZVAL(zv);
165 #define ALLOC_ZVAL(z) # /Zend/zend_alloc.h
166 (z) = (zval *) emalloc(sizeof(zval))
727 #define INIT_PZVAL(z) # /Zend/zend.h
728 (z)->refcount__gc = 1;
729 (z)->is_ref__gc = 0;
php5.3以及php5.4之后 还是用宏 MAKE_STD_ZVAL; 但是 ALLOC_ZVAL 里面有了新的实现,是因为php5.3新的GC(垃圾回收机制)
#undef 是在后面取消以前定义的宏定义
/* The following macroses override macroses from zend_alloc.h */
203 #undef ALLOC_ZVAL
204 #define ALLOC_ZVAL(z)
205 do {
206 (z) = (zval*)emalloc(sizeof(zval_gc_info));
207 GC_ZVAL_INIT(z);
208 } while (0)
63 #define GC_ZVAL_INIT(z)
64 ((zval_gc_info*)(z))->u.buffered = NULL
至于为什么这样做,在 php5.3新的垃圾回收机制详解 中有详细的介绍