php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_alloc.h File Reference
#include <stdio.h>
#include "zend_types.h"
#include "../TSRM/TSRM.h"
#include "zend_alloc_sizes.h"

Go to the source code of this file.

Data Structures

struct  _zend_leak_info
 
struct  _zend_mm_handlers
 
struct  _zend_mm_storage
 

Macros

#define ZEND_MM_ALIGNMENT_MASK   ~(ZEND_MM_ALIGNMENT - 1)
 
#define ZEND_MM_ALIGNED_SIZE(size)
 
#define ZEND_MM_ALIGNED_SIZE_EX(size, alignment)
 
#define ZEND_MM_OVERHEAD   0
 
#define efree_size(ptr, size)
 
#define efree_size_rel(ptr, size)
 
#define _emalloc_large   _emalloc
 
#define _emalloc_huge   _emalloc
 
#define _efree_large   _efree
 
#define _efree_huge   _efree
 
#define emalloc(size)
 
#define emalloc_large(size)
 
#define emalloc_huge(size)
 
#define safe_emalloc(nmemb, size, offset)
 
#define efree(ptr)
 
#define efree_large(ptr)
 
#define efree_huge(ptr)
 
#define ecalloc(nmemb, size)
 
#define erealloc(ptr, size)
 
#define erealloc2(ptr, size, copy_size)
 
#define safe_erealloc(ptr, nmemb, size, offset)
 
#define erealloc_recoverable(ptr, size)
 
#define erealloc2_recoverable(ptr, size, copy_size)
 
#define estrdup(s)
 
#define estrndup(s, length)
 
#define zend_mem_block_size(ptr)
 
#define emalloc_rel(size)
 
#define safe_emalloc_rel(nmemb, size, offset)
 
#define efree_rel(ptr)
 
#define ecalloc_rel(nmemb, size)
 
#define erealloc_rel(ptr, size)
 
#define erealloc2_rel(ptr, size, copy_size)
 
#define erealloc_recoverable_rel(ptr, size)
 
#define erealloc2_recoverable_rel(ptr, size, copy_size)
 
#define safe_erealloc_rel(ptr, nmemb, size, offset)
 
#define estrdup_rel(s)
 
#define estrndup_rel(s, length)
 
#define zend_mem_block_size_rel(ptr)
 
#define pemalloc(size, persistent)
 
#define safe_pemalloc(nmemb, size, offset, persistent)
 
#define pefree(ptr, persistent)
 
#define pefree_size(ptr, size, persistent)
 
#define pecalloc(nmemb, size, persistent)
 
#define perealloc(ptr, size, persistent)
 
#define perealloc2(ptr, size, copy_size, persistent)
 
#define safe_perealloc(ptr, nmemb, size, offset, persistent)
 
#define perealloc_recoverable(ptr, size, persistent)
 
#define perealloc2_recoverable(ptr, size, persistent)
 
#define pestrdup(s, persistent)
 
#define pestrndup(s, length, persistent)
 
#define pemalloc_rel(size, persistent)
 
#define pefree_rel(ptr, persistent)
 
#define pecalloc_rel(nmemb, size, persistent)
 
#define perealloc_rel(ptr, size, persistent)
 
#define perealloc2_rel(ptr, size, copy_size, persistent)
 
#define perealloc_recoverable_rel(ptr, size, persistent)
 
#define perealloc2_recoverable_rel(ptr, size, copy_size, persistent)
 
#define pestrdup_rel(s, persistent)
 
#define ALLOC_HASHTABLE(ht)
 
#define FREE_HASHTABLE(ht)
 
#define ALLOC_HASHTABLE_REL(ht)
 
#define FREE_HASHTABLE_REL(ht)
 
#define zend_mm_alloc(heap, size)
 
#define zend_mm_free(heap, p)
 
#define zend_mm_realloc(heap, p, size)
 
#define zend_mm_realloc2(heap, p, size, copy_size)
 
#define zend_mm_block_size(heap, p)
 
#define zend_mm_alloc_rel(heap, size)
 
#define zend_mm_free_rel(heap, p)
 
#define zend_mm_realloc_rel(heap, p, size)
 
#define zend_mm_realloc2_rel(heap, p, size, copy_size)
 
#define zend_mm_block_size_rel(heap, p)
 
#define ZEND_MM_CUSTOM_HEAP_NONE   0
 
#define ZEND_MM_CUSTOM_HEAP_STD   1
 
#define ZEND_MM_CUSTOM_HEAP_DEBUG   2
 

Typedefs

typedef struct _zend_leak_info zend_leak_info
 
typedef struct _zend_mm_heap zend_mm_heap
 
typedef struct _zend_mm_storage zend_mm_storage
 
typedef void *(* zend_mm_chunk_alloc_t) (zend_mm_storage *storage, size_t size, size_t alignment)
 
typedef void(* zend_mm_chunk_free_t) (zend_mm_storage *storage, void *chunk, size_t size)
 
typedef bool(* zend_mm_chunk_truncate_t) (zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size)
 
typedef bool(* zend_mm_chunk_extend_t) (zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size)
 
typedef struct _zend_mm_handlers zend_mm_handlers
 

Functions

ZEND_API ZEND_ATTRIBUTE_MALLOC char *ZEND_FASTCALL zend_strndup (const char *s, size_t length)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _emalloc (size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(1)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _safe_emalloc (size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _safe_malloc (size_t nmemb, size_t size, size_t offset)
 
ZEND_API void ZEND_FASTCALL _efree (void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _ecalloc (size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE2(1
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL ZEND_API void *ZEND_FASTCALL _erealloc (void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
 
ZEND_API void *ZEND_FASTCALL _erealloc2 (void *ptr, size_t size, size_t copy_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
 
ZEND_API void *ZEND_FASTCALL _safe_erealloc (void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API void *ZEND_FASTCALL _safe_realloc (void *ptr, size_t nmemb, size_t size, size_t offset)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC char *ZEND_FASTCALL _estrdup (const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC char *ZEND_FASTCALL _estrndup (const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size (void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void__zend_malloc (size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(1)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void__zend_calloc (size_t nmemb, size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE2(1
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void ZEND_API void__zend_realloc (void *p, size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
 
ZEND_API void __zend_free (void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC char * __zend_strdup (const char *s)
 
ZEND_API zend_result zend_set_memory_limit (size_t memory_limit)
 
ZEND_API bool zend_alloc_in_memory_limit_error_reporting (void)
 
ZEND_API void start_memory_manager (void)
 
ZEND_API void shutdown_memory_manager (bool silent, bool full_shutdown)
 
ZEND_API bool is_zend_mm (void)
 
ZEND_API bool is_zend_ptr (const void *ptr)
 
ZEND_API size_t zend_memory_usage (bool real_usage)
 
ZEND_API size_t zend_memory_peak_usage (bool real_usage)
 
ZEND_API void zend_memory_reset_peak_usage (void)
 
ZEND_API zend_mm_heapzend_mm_startup (void)
 
ZEND_API void zend_mm_shutdown (zend_mm_heap *heap, bool full_shutdown, bool silent)
 
ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _zend_mm_alloc (zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) ZEND_ATTRIBUTE_ALLOC_SIZE(2)
 
ZEND_API void ZEND_FASTCALL _zend_mm_free (zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API void *ZEND_FASTCALL _zend_mm_realloc (zend_mm_heap *heap, void *p, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API void *ZEND_FASTCALL _zend_mm_realloc2 (zend_mm_heap *heap, void *p, size_t size, size_t copy_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API size_t ZEND_FASTCALL _zend_mm_block_size (zend_mm_heap *heap, void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
 
ZEND_API zend_mm_heapzend_mm_set_heap (zend_mm_heap *new_heap)
 
ZEND_API zend_mm_heapzend_mm_get_heap (void)
 
ZEND_API size_t zend_mm_gc (zend_mm_heap *heap)
 
ZEND_API bool zend_mm_is_custom_heap (zend_mm_heap *new_heap)
 
ZEND_API void zend_mm_set_custom_handlers (zend_mm_heap *heap, void *(*_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), void(*_free)(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), void *(*_realloc)(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC))
 
ZEND_API void zend_mm_set_custom_handlers_ex (zend_mm_heap *heap, void *(*_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), void(*_free)(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), void *(*_realloc)(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), size_t(*_gc)(void), void(*_shutdown)(bool, bool))
 
ZEND_API void zend_mm_get_custom_handlers (zend_mm_heap *heap, void *(**_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), void(**_free)(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), void *(**_realloc)(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC))
 
ZEND_API void zend_mm_get_custom_handlers_ex (zend_mm_heap *heap, void *(**_malloc)(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), void(**_free)(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), void *(**_realloc)(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC), size_t(**_gc)(void), void(**_shutdown)(bool, bool))
 
ZEND_API zend_mm_storagezend_mm_get_storage (zend_mm_heap *heap)
 
ZEND_API zend_mm_heapzend_mm_startup_ex (const zend_mm_handlers *handlers, void *data, size_t data_size)
 

Macro Definition Documentation

◆ _efree_huge

#define _efree_huge   _efree

Definition at line 146 of file zend_alloc.h.

◆ _efree_large

#define _efree_large   _efree

Definition at line 145 of file zend_alloc.h.

◆ _emalloc_huge

#define _emalloc_huge   _emalloc

Definition at line 144 of file zend_alloc.h.

◆ _emalloc_large

#define _emalloc_large   _emalloc

Definition at line 143 of file zend_alloc.h.

◆ ALLOC_HASHTABLE

#define ALLOC_HASHTABLE ( ht)
Value:
(ht) = (HashTable *) emalloc(sizeof(HashTable))
HashTable * ht
Definition ffi.c:4838
#define emalloc(size)
Definition zend_alloc.h:151
struct _zend_array HashTable
Definition zend_types.h:386

Definition at line 231 of file zend_alloc.h.

◆ ALLOC_HASHTABLE_REL

#define ALLOC_HASHTABLE_REL ( ht)
Value:
(ht) = (HashTable *) emalloc_rel(sizeof(HashTable))
#define emalloc_rel(size)
Definition zend_alloc.h:169

Definition at line 237 of file zend_alloc.h.

◆ ecalloc

#define ecalloc ( nmemb,
size )
Value:
new_type size
Definition ffi.c:4365
ZEND_API void *ZEND_FASTCALL _ecalloc(size_t nmemb, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
#define ZEND_FILE_LINE_EMPTY_CC
#define ZEND_FILE_LINE_CC

Definition at line 158 of file zend_alloc.h.

◆ ecalloc_rel

#define ecalloc_rel ( nmemb,
size )
Value:

Definition at line 172 of file zend_alloc.h.

◆ efree

#define efree ( ptr)
Value:
void * ptr
Definition ffi.c:3814
ZEND_API void ZEND_FASTCALL _efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 155 of file zend_alloc.h.

◆ efree_huge

#define efree_huge ( ptr)
Value:

Definition at line 157 of file zend_alloc.h.

◆ efree_large

#define efree_large ( ptr)
Value:

Definition at line 156 of file zend_alloc.h.

◆ efree_rel

#define efree_rel ( ptr)
Value:

Definition at line 171 of file zend_alloc.h.

◆ efree_size

#define efree_size ( ptr,
size )
Value:
#define efree(ptr)
Definition zend_alloc.h:155

Definition at line 138 of file zend_alloc.h.

◆ efree_size_rel

#define efree_size_rel ( ptr,
size )
Value:
#define efree_rel(ptr)
Definition zend_alloc.h:171

Definition at line 140 of file zend_alloc.h.

◆ emalloc

#define emalloc ( size)
Value:
ZEND_API void *ZEND_FASTCALL _emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 151 of file zend_alloc.h.

◆ emalloc_huge

#define emalloc_huge ( size)
Value:

Definition at line 153 of file zend_alloc.h.

◆ emalloc_large

#define emalloc_large ( size)
Value:

Definition at line 152 of file zend_alloc.h.

◆ emalloc_rel

#define emalloc_rel ( size)

◆ erealloc

#define erealloc ( ptr,
size )
Value:
ZEND_API void *ZEND_FASTCALL _erealloc(void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 159 of file zend_alloc.h.

◆ erealloc2

#define erealloc2 ( ptr,
size,
copy_size )
Value:
ZEND_API void *ZEND_FASTCALL _erealloc2(void *ptr, size_t size, size_t copy_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 160 of file zend_alloc.h.

◆ erealloc2_recoverable

#define erealloc2_recoverable ( ptr,
size,
copy_size )
Value:

Definition at line 163 of file zend_alloc.h.

◆ erealloc2_recoverable_rel

#define erealloc2_recoverable_rel ( ptr,
size,
copy_size )
Value:

Definition at line 176 of file zend_alloc.h.

◆ erealloc2_rel

#define erealloc2_rel ( ptr,
size,
copy_size )
Value:

Definition at line 174 of file zend_alloc.h.

◆ erealloc_recoverable

#define erealloc_recoverable ( ptr,
size )
Value:

Definition at line 162 of file zend_alloc.h.

◆ erealloc_recoverable_rel

#define erealloc_recoverable_rel ( ptr,
size )
Value:

Definition at line 175 of file zend_alloc.h.

◆ erealloc_rel

#define erealloc_rel ( ptr,
size )
Value:

Definition at line 173 of file zend_alloc.h.

◆ estrdup

#define estrdup ( s)
Value:
char s[4]
Definition cdf.c:77
ZEND_API char *ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 164 of file zend_alloc.h.

◆ estrdup_rel

#define estrdup_rel ( s)
Value:

Definition at line 178 of file zend_alloc.h.

◆ estrndup

#define estrndup ( s,
length )
Value:
ZEND_API char *ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 165 of file zend_alloc.h.

◆ estrndup_rel

#define estrndup_rel ( s,
length )
Value:

Definition at line 179 of file zend_alloc.h.

◆ FREE_HASHTABLE

#define FREE_HASHTABLE ( ht)
Value:
#define efree_size(ptr, size)
Definition zend_alloc.h:138

Definition at line 234 of file zend_alloc.h.

◆ FREE_HASHTABLE_REL

#define FREE_HASHTABLE_REL ( ht)
Value:
#define efree_size_rel(ptr, size)
Definition zend_alloc.h:140

Definition at line 240 of file zend_alloc.h.

◆ pecalloc

#define pecalloc ( nmemb,
size,
persistent )
Value:
ffi persistent
Definition ffi.c:3633
ZEND_API void * __zend_calloc(size_t nmemb, size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
#define ecalloc(nmemb, size)
Definition zend_alloc.h:158

Definition at line 200 of file zend_alloc.h.

◆ pecalloc_rel

#define pecalloc_rel ( nmemb,
size,
persistent )
Value:
#define ecalloc_rel(nmemb, size)
Definition zend_alloc.h:172

Definition at line 211 of file zend_alloc.h.

◆ pefree

#define pefree ( ptr,
persistent )
Value:
((persistent)?free(ptr):efree(ptr))

Definition at line 191 of file zend_alloc.h.

◆ pefree_rel

#define pefree_rel ( ptr,
persistent )
Value:

Definition at line 210 of file zend_alloc.h.

◆ pefree_size

#define pefree_size ( ptr,
size,
persistent )
Value:
do { \
if (persistent) { \
free(ptr); \
} else { \
efree_size(ptr, size);\
} \
} while (0)

Definition at line 192 of file zend_alloc.h.

◆ pemalloc

#define pemalloc ( size,
persistent )
Value:
ZEND_API void * __zend_malloc(size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 189 of file zend_alloc.h.

◆ pemalloc_rel

◆ perealloc

#define perealloc ( ptr,
size,
persistent )
Value:
ZEND_API void * __zend_realloc(void *p, size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
#define erealloc(ptr, size)
Definition zend_alloc.h:159

Definition at line 201 of file zend_alloc.h.

◆ perealloc2

#define perealloc2 ( ptr,
size,
copy_size,
persistent )
Value:
#define erealloc2(ptr, size, copy_size)
Definition zend_alloc.h:160

Definition at line 202 of file zend_alloc.h.

◆ perealloc2_recoverable

#define perealloc2_recoverable ( ptr,
size,
persistent )
Value:
((persistent)?realloc((ptr), (size)):erealloc2_recoverable((ptr), (size), (copy_size)))
#define erealloc2_recoverable(ptr, size, copy_size)
Definition zend_alloc.h:163

Definition at line 205 of file zend_alloc.h.

◆ perealloc2_recoverable_rel

#define perealloc2_recoverable_rel ( ptr,
size,
copy_size,
persistent )
Value:
((persistent)?realloc((ptr), (size)):erealloc2_recoverable_rel((ptr), (size), (copy_size)))
#define erealloc2_recoverable_rel(ptr, size, copy_size)
Definition zend_alloc.h:176

Definition at line 215 of file zend_alloc.h.

◆ perealloc2_rel

#define perealloc2_rel ( ptr,
size,
copy_size,
persistent )
Value:
#define erealloc2_rel(ptr, size, copy_size)
Definition zend_alloc.h:174

Definition at line 213 of file zend_alloc.h.

◆ perealloc_recoverable

#define perealloc_recoverable ( ptr,
size,
persistent )
Value:
#define erealloc_recoverable(ptr, size)
Definition zend_alloc.h:162

Definition at line 204 of file zend_alloc.h.

◆ perealloc_recoverable_rel

#define perealloc_recoverable_rel ( ptr,
size,
persistent )
Value:
#define erealloc_recoverable_rel(ptr, size)
Definition zend_alloc.h:175

Definition at line 214 of file zend_alloc.h.

◆ perealloc_rel

#define perealloc_rel ( ptr,
size,
persistent )
Value:

Definition at line 212 of file zend_alloc.h.

◆ pestrdup

#define pestrdup ( s,
persistent )
Value:
ZEND_API char * __zend_strdup(const char *s)
#define estrdup(s)
Definition zend_alloc.h:164

Definition at line 206 of file zend_alloc.h.

◆ pestrdup_rel

#define pestrdup_rel ( s,
persistent )
Value:
((persistent)?strdup(s):estrdup_rel(s))
#define estrdup_rel(s)
Definition zend_alloc.h:178

Definition at line 216 of file zend_alloc.h.

◆ pestrndup

#define pestrndup ( s,
length,
persistent )
Value:
((persistent)?zend_strndup((s),(length)):estrndup((s),(length)))
ZEND_API char *ZEND_FASTCALL zend_strndup(const char *s, size_t length)
#define estrndup(s, length)
Definition zend_alloc.h:165

Definition at line 207 of file zend_alloc.h.

◆ safe_emalloc

#define safe_emalloc ( nmemb,
size,
offset )
Value:
zend_long offset
ZEND_API void *ZEND_FASTCALL _safe_emalloc(size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 154 of file zend_alloc.h.

◆ safe_emalloc_rel

#define safe_emalloc_rel ( nmemb,
size,
offset )
Value:

Definition at line 170 of file zend_alloc.h.

◆ safe_erealloc

#define safe_erealloc ( ptr,
nmemb,
size,
offset )
Value:
ZEND_API void *ZEND_FASTCALL _safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 161 of file zend_alloc.h.

◆ safe_erealloc_rel

#define safe_erealloc_rel ( ptr,
nmemb,
size,
offset )
Value:

Definition at line 177 of file zend_alloc.h.

◆ safe_pemalloc

#define safe_pemalloc ( nmemb,
size,
offset,
persistent )
Value:
ZEND_API void *ZEND_FASTCALL _safe_malloc(size_t nmemb, size_t size, size_t offset)
#define safe_emalloc(nmemb, size, offset)
Definition zend_alloc.h:154

Definition at line 190 of file zend_alloc.h.

◆ safe_perealloc

#define safe_perealloc ( ptr,
nmemb,
size,
offset,
persistent )
Value:
((persistent)?_safe_realloc((ptr), (nmemb), (size), (offset)):safe_erealloc((ptr), (nmemb), (size), (offset)))
ZEND_API void *ZEND_FASTCALL _safe_realloc(void *ptr, size_t nmemb, size_t size, size_t offset)
#define safe_erealloc(ptr, nmemb, size, offset)
Definition zend_alloc.h:161

Definition at line 203 of file zend_alloc.h.

◆ zend_mem_block_size

#define zend_mem_block_size ( ptr)
Value:
ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 166 of file zend_alloc.h.

◆ zend_mem_block_size_rel

#define zend_mem_block_size_rel ( ptr)

◆ ZEND_MM_ALIGNED_SIZE

#define ZEND_MM_ALIGNED_SIZE ( size)
Value:
(((size) + ZEND_MM_ALIGNMENT - 1) & ZEND_MM_ALIGNMENT_MASK)
#define ZEND_MM_ALIGNMENT_MASK
Definition zend_alloc.h:33

Definition at line 35 of file zend_alloc.h.

◆ ZEND_MM_ALIGNED_SIZE_EX

#define ZEND_MM_ALIGNED_SIZE_EX ( size,
alignment )
Value:
(((size) + ((alignment) - 1)) & ~((alignment) - 1))

Definition at line 37 of file zend_alloc.h.

◆ ZEND_MM_ALIGNMENT_MASK

#define ZEND_MM_ALIGNMENT_MASK   ~(ZEND_MM_ALIGNMENT - 1)

Definition at line 33 of file zend_alloc.h.

◆ zend_mm_alloc

#define zend_mm_alloc ( heap,
size )
Value:
ZEND_API void *ZEND_FASTCALL _zend_mm_alloc(zend_mm_heap *heap, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 254 of file zend_alloc.h.

◆ zend_mm_alloc_rel

#define zend_mm_alloc_rel ( heap,
size )
Value:

Definition at line 260 of file zend_alloc.h.

◆ zend_mm_block_size

#define zend_mm_block_size ( heap,
p )
Value:
p
Definition session.c:1105
ZEND_API size_t ZEND_FASTCALL _zend_mm_block_size(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 258 of file zend_alloc.h.

◆ zend_mm_block_size_rel

#define zend_mm_block_size_rel ( heap,
p )
Value:

Definition at line 264 of file zend_alloc.h.

◆ ZEND_MM_CUSTOM_HEAP_DEBUG

#define ZEND_MM_CUSTOM_HEAP_DEBUG   2

Definition at line 273 of file zend_alloc.h.

◆ ZEND_MM_CUSTOM_HEAP_NONE

#define ZEND_MM_CUSTOM_HEAP_NONE   0

Definition at line 271 of file zend_alloc.h.

◆ ZEND_MM_CUSTOM_HEAP_STD

#define ZEND_MM_CUSTOM_HEAP_STD   1

Definition at line 272 of file zend_alloc.h.

◆ zend_mm_free

#define zend_mm_free ( heap,
p )
Value:
ZEND_API void ZEND_FASTCALL _zend_mm_free(zend_mm_heap *heap, void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 255 of file zend_alloc.h.

◆ zend_mm_free_rel

#define zend_mm_free_rel ( heap,
p )
Value:

Definition at line 261 of file zend_alloc.h.

◆ ZEND_MM_OVERHEAD

#define ZEND_MM_OVERHEAD   0

Definition at line 60 of file zend_alloc.h.

◆ zend_mm_realloc

#define zend_mm_realloc ( heap,
p,
size )
Value:
void *ZEND_FASTCALL _zend_mm_realloc(zend_mm_heap *heap, void *ptr, size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 256 of file zend_alloc.h.

◆ zend_mm_realloc2

#define zend_mm_realloc2 ( heap,
p,
size,
copy_size )
Value:
void *ZEND_FASTCALL _zend_mm_realloc2(zend_mm_heap *heap, void *ptr, size_t size, size_t copy_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 257 of file zend_alloc.h.

◆ zend_mm_realloc2_rel

#define zend_mm_realloc2_rel ( heap,
p,
size,
copy_size )
Value:

Definition at line 263 of file zend_alloc.h.

◆ zend_mm_realloc_rel

#define zend_mm_realloc_rel ( heap,
p,
size )
Value:

Definition at line 262 of file zend_alloc.h.

Typedef Documentation

◆ zend_leak_info

◆ zend_mm_chunk_alloc_t

typedef void *(* zend_mm_chunk_alloc_t) (zend_mm_storage *storage, size_t size, size_t alignment)

Definition at line 299 of file zend_alloc.h.

◆ zend_mm_chunk_extend_t

typedef bool(* zend_mm_chunk_extend_t) (zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size)

Definition at line 302 of file zend_alloc.h.

◆ zend_mm_chunk_free_t

typedef void(* zend_mm_chunk_free_t) (zend_mm_storage *storage, void *chunk, size_t size)

Definition at line 300 of file zend_alloc.h.

◆ zend_mm_chunk_truncate_t

typedef bool(* zend_mm_chunk_truncate_t) (zend_mm_storage *storage, void *chunk, size_t old_size, size_t new_size)

Definition at line 301 of file zend_alloc.h.

◆ zend_mm_handlers

◆ zend_mm_heap

typedef struct _zend_mm_heap zend_mm_heap

Definition at line 244 of file zend_alloc.h.

◆ zend_mm_storage

Definition at line 297 of file zend_alloc.h.

Function Documentation

◆ __zend_calloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void * __zend_calloc ( size_t nmemb,
size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

◆ __zend_free()

ZEND_API void __zend_free ( void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 3306 of file zend_alloc.c.

◆ __zend_malloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void * __zend_malloc ( size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 3278 of file zend_alloc.c.

◆ __zend_realloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void ZEND_API void * __zend_realloc ( void * p,
size_t len ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 3297 of file zend_alloc.c.

◆ __zend_strdup()

ZEND_API ZEND_ATTRIBUTE_MALLOC char * __zend_strdup ( const char * s)

Definition at line 3312 of file zend_alloc.c.

◆ _ecalloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _ecalloc ( size_t nmemb,
size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

◆ _efree()

ZEND_API void ZEND_FASTCALL _efree ( void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 2743 of file zend_alloc.c.

◆ _emalloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _emalloc ( size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 2733 of file zend_alloc.c.

◆ _erealloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL ZEND_API void *ZEND_FASTCALL _erealloc ( void * ptr,
size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 2754 of file zend_alloc.c.

◆ _erealloc2()

ZEND_API void *ZEND_FASTCALL _erealloc2 ( void * ptr,
size_t size,
size_t copy_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 2764 of file zend_alloc.c.

◆ _estrdup()

ZEND_API ZEND_ATTRIBUTE_MALLOC char *ZEND_FASTCALL _estrdup ( const char *s ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 2809 of file zend_alloc.c.

◆ _estrndup()

ZEND_API ZEND_ATTRIBUTE_MALLOC char *ZEND_FASTCALL _estrndup ( const char * s,
size_t length ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 2823 of file zend_alloc.c.

◆ _safe_emalloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _safe_emalloc ( size_t nmemb,
size_t size,
size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 2779 of file zend_alloc.c.

◆ _safe_erealloc()

ZEND_API void *ZEND_FASTCALL _safe_erealloc ( void * ptr,
size_t nmemb,
size_t size,
size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 2789 of file zend_alloc.c.

◆ _safe_malloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _safe_malloc ( size_t nmemb,
size_t size,
size_t offset )

Definition at line 2784 of file zend_alloc.c.

◆ _safe_realloc()

ZEND_API void *ZEND_FASTCALL _safe_realloc ( void * ptr,
size_t nmemb,
size_t size,
size_t offset )

Definition at line 2794 of file zend_alloc.c.

◆ _zend_mem_block_size()

ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size ( void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)

Definition at line 2774 of file zend_alloc.c.

◆ _zend_mm_alloc()

ZEND_API ZEND_ATTRIBUTE_MALLOC void *ZEND_FASTCALL _zend_mm_alloc ( zend_mm_heap * heap,
size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 2528 of file zend_alloc.c.

◆ _zend_mm_block_size()

ZEND_API size_t ZEND_FASTCALL _zend_mm_block_size ( zend_mm_heap * heap,
void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

◆ _zend_mm_free()

ZEND_API void ZEND_FASTCALL _zend_mm_free ( zend_mm_heap * heap,
void *p ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

◆ _zend_mm_realloc()

ZEND_API void *ZEND_FASTCALL _zend_mm_realloc ( zend_mm_heap * heap,
void * p,
size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 2538 of file zend_alloc.c.

◆ _zend_mm_realloc2()

ZEND_API void *ZEND_FASTCALL _zend_mm_realloc2 ( zend_mm_heap * heap,
void * p,
size_t size,
size_t copy_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC )

Definition at line 2543 of file zend_alloc.c.

◆ is_zend_mm()

ZEND_API bool is_zend_mm ( void )

Definition at line 2582 of file zend_alloc.c.

◆ is_zend_ptr()

ZEND_API bool is_zend_ptr ( const void * ptr)

Definition at line 2591 of file zend_alloc.c.

◆ shutdown_memory_manager()

ZEND_API void shutdown_memory_manager ( bool silent,
bool full_shutdown )

Definition at line 2922 of file zend_alloc.c.

◆ start_memory_manager()

ZEND_API void start_memory_manager ( void )

Definition at line 3069 of file zend_alloc.c.

◆ zend_alloc_in_memory_limit_error_reporting()

ZEND_API bool zend_alloc_in_memory_limit_error_reporting ( void )

Definition at line 2880 of file zend_alloc.c.

◆ zend_memory_peak_usage()

ZEND_API size_t zend_memory_peak_usage ( bool real_usage)

Definition at line 2902 of file zend_alloc.c.

◆ zend_memory_reset_peak_usage()

ZEND_API void zend_memory_reset_peak_usage ( void )

Definition at line 2914 of file zend_alloc.c.

◆ zend_memory_usage()

ZEND_API size_t zend_memory_usage ( bool real_usage)

Definition at line 2889 of file zend_alloc.c.

◆ zend_mm_gc()

ZEND_API size_t zend_mm_gc ( zend_mm_heap * heap)

Definition at line 2072 of file zend_alloc.c.

◆ zend_mm_get_custom_handlers()

ZEND_API void zend_mm_get_custom_handlers ( zend_mm_heap * heap,
void *(** _malloc )(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void(** _free )(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void *(** _realloc )(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) )

Definition at line 3141 of file zend_alloc.c.

◆ zend_mm_get_custom_handlers_ex()

ZEND_API void zend_mm_get_custom_handlers_ex ( zend_mm_heap * heap,
void *(** _malloc )(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void(** _free )(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void *(** _realloc )(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
size_t(** _gc )(void),
void(** _shutdown )(bool, bool) )

Definition at line 3151 of file zend_alloc.c.

◆ zend_mm_get_heap()

ZEND_API zend_mm_heap * zend_mm_get_heap ( void )

Definition at line 3094 of file zend_alloc.c.

◆ zend_mm_get_storage()

ZEND_API zend_mm_storage * zend_mm_get_storage ( zend_mm_heap * heap)

Definition at line 3191 of file zend_alloc.c.

◆ zend_mm_is_custom_heap()

ZEND_API bool zend_mm_is_custom_heap ( zend_mm_heap * new_heap)

Definition at line 3099 of file zend_alloc.c.

◆ zend_mm_set_custom_handlers()

ZEND_API void zend_mm_set_custom_handlers ( zend_mm_heap * heap,
void *(* _malloc )(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void(* _free )(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void *(* _realloc )(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) )

Definition at line 3108 of file zend_alloc.c.

◆ zend_mm_set_custom_handlers_ex()

ZEND_API void zend_mm_set_custom_handlers_ex ( zend_mm_heap * heap,
void *(* _malloc )(size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void(* _free )(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
void *(* _realloc )(void *, size_t ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC),
size_t(* _gc )(void),
void(* _shutdown )(bool, bool) )

Definition at line 3118 of file zend_alloc.c.

◆ zend_mm_set_heap()

ZEND_API zend_mm_heap * zend_mm_set_heap ( zend_mm_heap * new_heap)

Definition at line 3085 of file zend_alloc.c.

◆ zend_mm_shutdown()

ZEND_API void zend_mm_shutdown ( zend_mm_heap * heap,
bool full_shutdown,
bool silent )

Definition at line 2394 of file zend_alloc.c.

◆ zend_mm_startup()

ZEND_API zend_mm_heap * zend_mm_startup ( void )

Definition at line 3200 of file zend_alloc.c.

◆ zend_mm_startup_ex()

ZEND_API zend_mm_heap * zend_mm_startup_ex ( const zend_mm_handlers * handlers,
void * data,
size_t data_size )

Definition at line 3205 of file zend_alloc.c.

◆ zend_set_memory_limit()

ZEND_API zend_result zend_set_memory_limit ( size_t memory_limit)

Definition at line 2856 of file zend_alloc.c.

◆ zend_strndup()

ZEND_API ZEND_ATTRIBUTE_MALLOC char *ZEND_FASTCALL zend_strndup ( const char * s,
size_t length )

Definition at line 2838 of file zend_alloc.c.