docs/Writerside/topics/allocator.h.md

changeset 1539
2cbdb482d325
parent 1446
5732947cbcc2
equal deleted inserted replaced
1538:fd948e5af26e 1539:2cbdb482d325
37 37
38 int cxReallocateArray(const CxAllocator *allocator, void **mem, 38 int cxReallocateArray(const CxAllocator *allocator, void **mem,
39 size_t nmemb, size_t size); 39 size_t nmemb, size_t size);
40 40
41 void cxFree(const CxAllocator *allocator, void *mem); 41 void cxFree(const CxAllocator *allocator, void *mem);
42
43 void cx_system_page_size(void);
42 44
43 void *cx_zalloc(size_t n); 45 void *cx_zalloc(size_t n);
44 46
45 int cx_reallocate(void **mem, size_t n); 47 int cx_reallocate(void **mem, size_t n);
46 48
102 ``` 104 ```
103 105
104 > Please pay special attention to always use `cxFree()` and the `cxRealloc()`-family of functions 106 > Please pay special attention to always use `cxFree()` and the `cxRealloc()`-family of functions
105 > with the **same** allocator that was used to allocate the memory. 107 > with the **same** allocator that was used to allocate the memory.
106 {style="warning"} 108 {style="warning"}
109
110 The function `cx_system_page_size()` offers a cross-platform way to retrieve the memory page size in bytes.
111 If, for some reason, the page size cannot be determined, a default of 4096 bytes is returned.
107 112
108 ## Custom Allocator 113 ## Custom Allocator
109 114
110 If you want to define your own allocator, you need to initialize the `CxAllocator` structure 115 If you want to define your own allocator, you need to initialize the `CxAllocator` structure
111 with a pointer to an allocator class (containing function pointers for the memory management 116 with a pointer to an allocator class (containing function pointers for the memory management

mercurial