Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Improve tracking

- Fix several overloading issues
  • Loading branch information...
commit 49c4866a4798716e40c6502dfb2edca7611edbfd 1 parent 0dba58c
@zsuraski zsuraski authored
View
1  Zend/zend.h
@@ -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
11 Zend/zend_alloc.c
@@ -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
9 Zend/zend_compile.h
@@ -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
7 Zend/zend_execute.c
@@ -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;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.