- 论坛徽章:
- 0
|
关于PHP中的引用传值或返回值总结(英文)
首先,ZEND 里面定义的两个函数
ZEND_API void start_memory_manager(TSRMLS_D);
ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC);
PHP5.0b2
在源代码 的 main.c 里面的 php_request_shutdown_for_exec 函数里有
1190 行 开始:
- void php_request_shutdown(void *dummy)
- {
- TSRMLS_FETCH();
- /* EG(opline_ptr) points into nirvana and therefore cannot be safely accessed
- * inside zend_executor callback functions.
- */
- EG(opline_ptr) = NULL;
- zend_try {
- zend_exec_finished(TSRMLS_C);
- } zend_end_try();
- zend_try {
- php_end_ob_buffers((zend_bool)(SG(request_info).headers_only?0:1) TSRMLS_CC);
- } zend_end_try();
- zend_try {
- sapi_send_headers(TSRMLS_C);
- } zend_end_try();
- if (PG(modules_activated)) zend_try {
- php_call_shutdown_functions();
- } zend_end_try();
-
- if (PG(modules_activated)) {
- zend_deactivate_modules(TSRMLS_C);
- }
- zend_try {
- int i;
- for (i=0; i<NUM_TRACK_VARS; i++) {
- if (PG(http_globals)[i]) {
- zval_ptr_dtor(&PG(http_globals)[i]);
- }
- }
- } zend_end_try();
-
- zend_deactivate(TSRMLS_C);
- zend_try {
- sapi_deactivate(TSRMLS_C);
- } zend_end_try();
- zend_try {
- shutdown_memory_manager(CG(unclean_shutdown), 0 TSRMLS_CC);
- } zend_end_try();
- zend_try {
- zend_unset_timeout(TSRMLS_C);
- } zend_end_try();
- #ifdef PHP_WIN32
- CoUninitialize();
- #endif
- }
- /* }}} */
复制代码
shutdown_memory_manager();
同样 其他方式 结束的时候 也会
调用 shutdown_memory_manager();
也就是说释放是在 php 程序执行完毕,返回结果之后就释放了 |
|