- Improve tracking

- Fix several overloading issues
This commit is contained in:
Zeev Suraski 2003-08-18 22:31:11 +00:00
parent 0dba58c373
commit 49c4866a47
4 changed files with 19 additions and 9 deletions

View File

@ -510,6 +510,7 @@ ZEND_API int zend_get_configuration_directive(char *name, uint name_length, zval
#define ZMSG_MEMORY_LEAK_DETECTED 4L
#define ZMSG_MEMORY_LEAK_REPEATED 5L
#define ZMSG_LOG_SCRIPT_NAME 6L
#define ZMSG_MEMORY_LEAKS_GRAND_TOTAL 7L
#define ZVAL_ADDREF(pz) (++(pz)->refcount)

View File

@ -471,10 +471,7 @@ ZEND_API void start_memory_manager(TSRMLS_D)
ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC)
{
zend_mem_header *p, *t;
#if ZEND_DEBUG
int had_leaks = 0;
#endif
zend_uint grand_total_leaks=0;
#if defined(ZEND_MM) && !ZEND_DEBUG
if (clean_cache) {
@ -534,7 +531,7 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC)
zend_mem_header *iterator;
int total_leak=0, total_leak_count=0;
had_leaks = 1;
grand_total_leaks++;
if (!silent) {
zend_message_dispatcher(ZMSG_MEMORY_LEAK_DETECTED, t);
}
@ -565,6 +562,10 @@ ZEND_API void shutdown_memory_manager(int silent, int clean_cache TSRMLS_DC)
}
}
if (grand_total_leaks > 0) {
zend_message_dispatcher(ZMSG_MEMORY_LEAKS_GRAND_TOTAL, &grand_total_leaks);
}
#if MEMORY_LIMIT
AG(memory_exhausted)=0;
AG(allocated_memory_peak) = 0;

View File

@ -720,10 +720,11 @@ int zendlex(znode *zendlval TSRMLS_DC);
#define BP_VAR_UNSET 6
#define ZEND_INTERNAL_FUNCTION 1
#define ZEND_USER_FUNCTION 2
#define ZEND_OVERLOADED_FUNCTION 3
#define ZEND_EVAL_CODE 4
#define ZEND_INTERNAL_FUNCTION 1
#define ZEND_USER_FUNCTION 2
#define ZEND_OVERLOADED_FUNCTION 3
#define ZEND_EVAL_CODE 4
#define ZEND_OVERLOADED_FUNCTION_TEMPORARY 5
#define ZEND_INTERNAL_CLASS 1
#define ZEND_USER_CLASS 2

View File

@ -2567,9 +2567,16 @@ int zend_do_fcall_common_helper(ZEND_OPCODE_HANDLER_ARGS)
zend_error(E_ERROR, "Cannot call overloaded function for non-object");
}
if (EX(function_state).function->type == ZEND_OVERLOADED_FUNCTION_TEMPORARY) {
efree(EX(function_state).function->common.function_name);
}
efree(EX(fbc));
if (!return_value_used) {
zval_ptr_dtor(&EX_T(EX(opline)->result.u.var).var.ptr);
} else {
EX_T(EX(opline)->result.u.var).var.ptr->is_ref = 0;
EX_T(EX(opline)->result.u.var).var.ptr->refcount = 1;
}
}