ZEND_MEMORY_LIMIT=no
])
-AC_ARG_ENABLE(memory-usage-info,
-[ --enable-memory-usage-info Compile with support for memory usage info. ], [
- ZEND_MEMORY_USAGE_INFO=$enableval
-],[
- ZEND_MEMORY_USAGE_INFO=no
-])
-
AC_MSG_CHECKING(whether to enable experimental ZTS)
AC_MSG_RESULT($ZEND_EXPERIMENTAL_ZTS)
AC_MSG_CHECKING(whether to enable a memory limit)
AC_MSG_RESULT($ZEND_MEMORY_LIMIT)
-AC_MSG_CHECKING(whether to enable a memory usage)
-AC_MSG_RESULT($ZEND_MEMORY_USAGE_INFO)
-
AC_MSG_CHECKING(whether to enable Zend debugging)
AC_MSG_RESULT($ZEND_DEBUG)
AC_DEFINE(MEMORY_LIMIT, 0, [Memory limit])
fi
-if test "$ZEND_MEMORY_USAGE_INFO" = "yes"; then
- AC_DEFINE(MEMORY_USAGE_INFO, 1, [Memory usage])
-else
- AC_DEFINE(MEMORY_USAGE_INFO, 0, [Memory usage])
-fi
-
changequote({,})
if test -n "$GCC" && test "$ZEND_INLINE_OPTIMIZATION" != "yes"; then
#endif
#if MEMORY_LIMIT
CHECK_MEMORY_LIMIT(size, SIZE);
-#endif
-#if MEMORY_USAGE_INFO
- AG(cur_allocated_memory) += SIZE;
- if (AG(cur_allocated_memory) > AG(max_allocated_memory))
- AG(max_allocated_memory) = AG(cur_allocated_memory);
+ if (AG(allocated_memory) > AG(allocated_memory_peak) {
+ AG(allocated_memory_peak) = AG(allocated_memory);
+ }
#endif
HANDLE_UNBLOCK_INTERRUPTIONS();
#if MEMORY_LIMIT
AG(allocated_memory) -= SIZE;
#endif
-#if MEMORY_USAGE_INFO
- AG(cur_allocated_memory) -= SIZE;
-#endif
free(p);
HANDLE_UNBLOCK_INTERRUPTIONS();
#endif
#if MEMORY_LIMIT
CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
-#endif
-#if MEMORY_USAGE_INFO
- AG(cur_allocated_memory) += SIZE - REAL_SIZE(p->size);
- if (AG(cur_allocated_memory) > AG(max_allocated_memory))
- AG(max_allocated_memory) = AG(cur_allocated_memory);
+ if (AG(allocated_memory) > AG(allocated_memory_peak)) {
+ AG(allocated_memory_peak) = AG(allocated_memory);
#endif
p->size = size;
AG(memory_limit) = 1<<30; /* rediculous limit, effectively no limit */
AG(allocated_memory) = 0;
AG(memory_exhausted) = 0;
-#endif
-#if MEMORY_USAGE_INFO
- AG(cur_allocated_memory) = 0;
- AG(max_allocated_memory) = 0;
+ AG(allocated_memory_peak) = 0;
#endif
memset(AG(fast_cache_list_head), 0, sizeof(AG(fast_cache_list_head)));
#if MEMORY_LIMIT
AG(memory_exhausted)=0;
#endif
-#if MEMORY_USAGE_INFO
- AG(cur_allocated_memory) = 0;
- AG(max_allocated_memory) = 0;
-#endif
+
#if (ZEND_DEBUG)
do {
unsigned int allocated_memory;
unsigned char memory_exhausted;
#endif
-#if MEMORY_USAGE_INFO
- unsigned int cur_allocated_memory;
- unsigned int max_allocated_memory;
-#endif
};
#endif /* ZEND_GLOBALS_H */
{
int result = send_php(r, 0, NULL);
-#if MEMORY_USAGE_INFO
+#if MEMORY_LIMIT
{
char mem_usage[ 32 ];
ALS_FETCH()
- sprintf(mem_usage,"%u", (int) AG(max_allocated_memory));
+ sprintf(mem_usage,"%u", (int) AG(allocated_memory_peak));
ap_table_setn(r->notes, "mod_php_memory_usage", ap_pstrdup(r->pool,mem_usage));
}
#endif