diff options
Diffstat (limited to 'ext/mysqlnd/mysqlnd_alloc.c')
-rw-r--r-- | ext/mysqlnd/mysqlnd_alloc.c | 189 |
1 files changed, 0 insertions, 189 deletions
diff --git a/ext/mysqlnd/mysqlnd_alloc.c b/ext/mysqlnd/mysqlnd_alloc.c index 6c8845248e..44a691e413 100644 --- a/ext/mysqlnd/mysqlnd_alloc.c +++ b/ext/mysqlnd/mysqlnd_alloc.c @@ -32,10 +32,6 @@ static const char mysqlnd_erealloc_name[] = "_mysqlnd_erealloc"; static const char mysqlnd_perealloc_name[] = "_mysqlnd_perealloc"; static const char mysqlnd_efree_name[] = "_mysqlnd_efree"; static const char mysqlnd_pefree_name[] = "_mysqlnd_pefree"; -static const char mysqlnd_malloc_name[] = "_mysqlnd_malloc"; -static const char mysqlnd_calloc_name[] = "_mysqlnd_calloc"; -static const char mysqlnd_realloc_name[] = "_mysqlnd_realloc"; -static const char mysqlnd_free_name[] = "_mysqlnd_free"; static const char mysqlnd_pememdup_name[] = "_mysqlnd_pememdup"; static const char mysqlnd_pestrndup_name[] = "_mysqlnd_pestrndup"; static const char mysqlnd_pestrdup_name[] = "_mysqlnd_pestrdup"; @@ -50,10 +46,6 @@ PHPAPI const char * mysqlnd_debug_std_no_trace_funcs[] = mysqlnd_pecalloc_name, mysqlnd_pefree_name, mysqlnd_perealloc_name, - mysqlnd_malloc_name, - mysqlnd_calloc_name, - mysqlnd_realloc_name, - mysqlnd_free_name, mysqlnd_pestrndup_name, mysqlnd_read_header_name, mysqlnd_read_body_name, @@ -262,147 +254,6 @@ static void _mysqlnd_pefree(void *ptr, zend_bool persistent MYSQLND_MEM_D) /* }}} */ -/* {{{ _mysqlnd_malloc */ -static void * _mysqlnd_malloc(size_t size MYSQLND_MEM_D) -{ - void *ret; - zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); -#if PHP_DEBUG - zend_long * threshold = &MYSQLND_G(debug_malloc_fail_threshold); - TRACE_ALLOC_ENTER(mysqlnd_malloc_name); - - { - char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno); - } - - if (*threshold == 0) { - ret = NULL; - } else { - ret = malloc(REAL_SIZE(size)); - --*threshold; - } -#else - TRACE_ALLOC_ENTER(mysqlnd_malloc_name); - ret = malloc(REAL_SIZE(size)); -#endif - - TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); - if (ret && collect_memory_statistics) { - *(size_t *) ret = size; - MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_MALLOC_COUNT, 1, STAT_MEM_MALLOC_AMOUNT, size); - } - TRACE_ALLOC_RETURN(FAKE_PTR(ret)); -} -/* }}} */ - - -/* {{{ _mysqlnd_calloc */ -static void * _mysqlnd_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) -{ - void *ret; - zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); -#if PHP_DEBUG - zend_long * threshold = &MYSQLND_G(debug_calloc_fail_threshold); - TRACE_ALLOC_ENTER(mysqlnd_calloc_name); - - { - char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno); - } - - if (*threshold == 0) { - ret = NULL; - } else { - ret = calloc(nmemb, REAL_SIZE(size)); - --*threshold; - } -#else - TRACE_ALLOC_ENTER(mysqlnd_calloc_name); - ret = calloc(nmemb, REAL_SIZE(size)); -#endif - - TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret); - if (ret && collect_memory_statistics) { - *(size_t *) ret = size; - MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_CALLOC_COUNT, 1, STAT_MEM_CALLOC_AMOUNT, size); - } - TRACE_ALLOC_RETURN(FAKE_PTR(ret)); -} -/* }}} */ - - -/* {{{ _mysqlnd_realloc */ -static void * _mysqlnd_realloc(void *ptr, size_t new_size MYSQLND_MEM_D) -{ - void *ret; - zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); -#if PHP_DEBUG - zend_long * threshold = &MYSQLND_G(debug_realloc_fail_threshold); - TRACE_ALLOC_ENTER(mysqlnd_realloc_name); - - { - char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno); - } - TRACE_ALLOC_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr); - TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(TRUE)); - - if (*threshold == 0) { - ret = NULL; - } else { - ret = realloc(REAL_PTR(ptr), REAL_SIZE(new_size)); - --*threshold; - } -#else - TRACE_ALLOC_ENTER(mysqlnd_realloc_name); - TRACE_ALLOC_INF_FMT("ptr=%p new_size=%lu ", new_size, ptr); - TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(TRUE)); - ret = realloc(REAL_PTR(ptr), REAL_SIZE(new_size)); -#endif - - TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret); - - if (ret && collect_memory_statistics) { - *(size_t *) ret = new_size; - MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_REALLOC_COUNT, 1, STAT_MEM_REALLOC_AMOUNT, new_size); - } - TRACE_ALLOC_RETURN(FAKE_PTR(ret)); -} -/* }}} */ - - -/* {{{ _mysqlnd_free */ -static void _mysqlnd_free(void *ptr MYSQLND_MEM_D) -{ - size_t free_amount = 0; - zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics); - TRACE_ALLOC_ENTER(mysqlnd_free_name); - -#if PHP_DEBUG - { - char * fn = strrchr(__zend_filename, PHP_DIR_SEPARATOR); - TRACE_ALLOC_INF_FMT("file=%-15s line=%4d", fn? fn + 1:__zend_filename, __zend_lineno); - } -#endif - TRACE_ALLOC_INF_FMT("ptr=%p", ptr); - - if (ptr) { - if (collect_memory_statistics) { - free_amount = *(size_t *)(((char*)ptr) - sizeof(size_t)); - TRACE_ALLOC_INF_FMT("ptr=%p size=%u", ((char*)ptr) - sizeof(size_t), (unsigned int) free_amount); - } - free(REAL_PTR(ptr)); - } - - if (collect_memory_statistics) { - MYSQLND_INC_GLOBAL_STATISTIC_W_VALUE2(STAT_MEM_FREE_COUNT, 1, STAT_MEM_FREE_AMOUNT, free_amount); - } - TRACE_ALLOC_VOID_RETURN; -} -/* }}} */ - - /* {{{ _mysqlnd_pememdup */ static char * _mysqlnd_pememdup(const char * const ptr, size_t length, zend_bool persistent MYSQLND_MEM_D) { @@ -607,38 +458,6 @@ static void mysqlnd_zend_mm_pefree(void * ptr, zend_bool persistent MYSQLND_MEM_ /* }}} */ -/* {{{ mysqlnd_zend_mm_malloc */ -static void * mysqlnd_zend_mm_malloc(size_t size MYSQLND_MEM_D) -{ - return malloc(size); -} -/* }}} */ - - -/* {{{ mysqlnd_zend_mm_calloc */ -static void * mysqlnd_zend_mm_calloc(unsigned int nmemb, size_t size MYSQLND_MEM_D) -{ - return calloc(nmemb, size); -} -/* }}} */ - - -/* {{{ mysqlnd_zend_mm_realloc */ -static void * mysqlnd_zend_mm_realloc(void * ptr, size_t new_size MYSQLND_MEM_D) -{ - return realloc(ptr, new_size); -} -/* }}} */ - - -/* {{{ mysqlnd_zend_mm_free */ -static void mysqlnd_zend_mm_free(void * ptr MYSQLND_MEM_D) -{ - free(ptr); -} -/* }}} */ - - /* {{{ mysqlnd_zend_mm_pememdup */ static char * mysqlnd_zend_mm_pememdup(const char * const ptr, size_t length, zend_bool persistent MYSQLND_MEM_D) { @@ -680,10 +499,6 @@ PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator = _mysqlnd_perealloc, _mysqlnd_efree, _mysqlnd_pefree, - _mysqlnd_malloc, - _mysqlnd_calloc, - _mysqlnd_realloc, - _mysqlnd_free, _mysqlnd_pememdup, _mysqlnd_pestrndup, _mysqlnd_pestrdup, @@ -699,10 +514,6 @@ PHPAPI struct st_mysqlnd_allocator_methods mysqlnd_allocator = mysqlnd_zend_mm_perealloc, mysqlnd_zend_mm_efree, mysqlnd_zend_mm_pefree, - mysqlnd_zend_mm_malloc, - mysqlnd_zend_mm_calloc, - mysqlnd_zend_mm_realloc, - mysqlnd_zend_mm_free, mysqlnd_zend_mm_pememdup, mysqlnd_zend_mm_pestrndup, mysqlnd_zend_mm_pestrdup, |