#endif
}
+ZEND_API int is_zend_ptr(const void *ptr)
+{
+#if ZEND_MM_CUSTOM
+ if (AG(mm_heap)->use_custom_heap) {
+ return 0;
+ }
+#endif
+
+ if (AG(mm_heap)->main_chunk) {
+ zend_mm_chunk *chunk = AG(mm_heap)->main_chunk;
+
+ do {
+ if (ptr >= (void*)chunk
+ && ptr < (void*)((char*)chunk + ZEND_MM_CHUNK_SIZE)) {
+ return 1;
+ }
+ chunk = chunk->next;
+ } while (chunk != AG(mm_heap)->main_chunk);
+ }
+
+ if (AG(mm_heap)->huge_list) {
+ zend_mm_huge_list *block = AG(mm_heap)->huge_list;
+
+ do {
+ if (ptr >= (void*)block
+ && ptr < (void*)((char*)block + block->size)) {
+ return 1;
+ }
+ block = block->next;
+ } while (block != AG(mm_heap)->huge_list);
+ }
+ return 0;
+}
+
#if !ZEND_DEBUG && defined(HAVE_BUILTIN_CONSTANT_P)
#undef _emalloc
ZEND_API void start_memory_manager(void);
ZEND_API void shutdown_memory_manager(int silent, int full_shutdown);
ZEND_API int is_zend_mm(void);
+ZEND_API int is_zend_ptr(const void *ptr);
ZEND_API size_t zend_memory_usage(int real_usage);
ZEND_API size_t zend_memory_peak_usage(int real_usage);