zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
zend_long * threshold = &MYSQLND_G(debug_emalloc_fail_threshold);
-#endif
TRACE_ALLOC_ENTER(mysqlnd_emalloc_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
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = emalloc_rel(REAL_SIZE(size));
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#else
+ TRACE_ALLOC_ENTER(mysqlnd_emalloc_name);
+ ret = emalloc_rel(REAL_SIZE(size));
#endif
TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret);
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
zend_long * threshold = persistent? &MYSQLND_G(debug_malloc_fail_threshold):&MYSQLND_G(debug_emalloc_fail_threshold);
-#endif
TRACE_ALLOC_ENTER(mysqlnd_pemalloc_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
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = pemalloc_rel(REAL_SIZE(size), persistent);
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#else
+ TRACE_ALLOC_ENTER(mysqlnd_pemalloc_name);
+ ret = pemalloc_rel(REAL_SIZE(size), persistent);
#endif
TRACE_ALLOC_INF_FMT("size=%lu ptr=%p persistent=%u", size, ret, persistent);
{
void *ret;
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
-#if PHP_DEBUG
zend_long * threshold = &MYSQLND_G(debug_ecalloc_fail_threshold);
-#endif
+#if PHP_DEBUG
TRACE_ALLOC_ENTER(mysqlnd_ecalloc_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("before: %lu", zend_memory_usage(FALSE));
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = ecalloc_rel(nmemb, REAL_SIZE(size));
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#else
+ TRACE_ALLOC_ENTER(mysqlnd_ecalloc_name);
+ TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(FALSE));
+ ret = ecalloc_rel(nmemb, REAL_SIZE(size));
#endif
TRACE_ALLOC_INF_FMT("after : %lu", zend_memory_usage(FALSE));
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
zend_long * threshold = persistent? &MYSQLND_G(debug_calloc_fail_threshold):&MYSQLND_G(debug_ecalloc_fail_threshold);
-#endif
TRACE_ALLOC_ENTER(mysqlnd_pecalloc_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
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = pecalloc_rel(nmemb, REAL_SIZE(size), persistent);
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#else
+ TRACE_ALLOC_ENTER(mysqlnd_pecalloc_name);
+ ret = pecalloc_rel(nmemb, REAL_SIZE(size), persistent);
#endif
TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret);
size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
#if PHP_DEBUG
zend_long * threshold = &MYSQLND_G(debug_erealloc_fail_threshold);
-#endif
TRACE_ALLOC_ENTER(mysqlnd_erealloc_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 old_size=%lu, new_size=%lu", ptr, old_size, new_size);
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = erealloc_rel(REAL_PTR(ptr), REAL_SIZE(new_size));
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#else
+ TRACE_ALLOC_ENTER(mysqlnd_erealloc_name);
+ TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu, new_size=%lu", ptr, old_size, new_size);
+ ret = erealloc_rel(REAL_PTR(ptr), REAL_SIZE(new_size));
#endif
TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret);
size_t old_size = collect_memory_statistics && ptr? *(size_t *) (((char*)ptr) - sizeof(size_t)) : 0;
#if PHP_DEBUG
zend_long * threshold = persistent? &MYSQLND_G(debug_realloc_fail_threshold):&MYSQLND_G(debug_erealloc_fail_threshold);
-#endif
TRACE_ALLOC_ENTER(mysqlnd_perealloc_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 old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent);
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = perealloc_rel(REAL_PTR(ptr), REAL_SIZE(new_size), persistent);
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#else
+ TRACE_ALLOC_ENTER(mysqlnd_perealloc_name);
+ TRACE_ALLOC_INF_FMT("ptr=%p old_size=%lu new_size=%lu persistent=%u", ptr, old_size, new_size, persistent);
+ ret = perealloc_rel(REAL_PTR(ptr), REAL_SIZE(new_size), persistent);
#endif
TRACE_ALLOC_INF_FMT("new_ptr=%p", (char*)ret);
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
zend_long * threshold = &MYSQLND_G(debug_malloc_fail_threshold);
-#endif
TRACE_ALLOC_ENTER(mysqlnd_malloc_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
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = malloc(REAL_SIZE(size));
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#else
+ TRACE_ALLOC_ENTER(mysqlnd_malloc_name);
+ ret = malloc(REAL_SIZE(size));
#endif
TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret);
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
zend_long * threshold = &MYSQLND_G(debug_calloc_fail_threshold);
-#endif
TRACE_ALLOC_ENTER(mysqlnd_calloc_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
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = calloc(nmemb, REAL_SIZE(size));
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#else
+ TRACE_ALLOC_ENTER(mysqlnd_calloc_name);
+ ret = calloc(nmemb, REAL_SIZE(size));
#endif
TRACE_ALLOC_INF_FMT("size=%lu ptr=%p", size, ret);
zend_bool collect_memory_statistics = MYSQLND_G(collect_memory_statistics);
#if PHP_DEBUG
zend_long * threshold = &MYSQLND_G(debug_realloc_fail_threshold);
-#endif
TRACE_ALLOC_ENTER(mysqlnd_realloc_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 new_size=%lu ", new_size, ptr);
TRACE_ALLOC_INF_FMT("before: %lu", zend_memory_usage(TRUE));
-#if PHP_DEBUG
- /* -1 is also "true" */
- if (*threshold) {
-#endif
+ if (*threshold == 0) {
+ ret = NULL;
+ } else {
ret = realloc(REAL_PTR(ptr), REAL_SIZE(new_size));
-#if PHP_DEBUG
--*threshold;
- } else if (*threshold == 0) {
- ret = NULL;
}
+#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);