Expand description
C ABI allocator compatibility — xmlMemSetup, xmlMemGet, xmlMalloc, xmlFree, etc. (§58).
This module implements the complete memory hook system exposed by libxml2:
- Global allocator function pointers (malloc, realloc, free, strdup)
xmlMemSetup()/xmlMemGet()— set/get allocator hooksxmlGcMemSetup()/xmlGcMemGet()— GC-aware allocator hooks (wrappers)xmlMalloc()/xmlMallocAtomic()/xmlRealloc()/xmlFree()/xmlMemStrdup()xmlMemUsed()/xmlMemBlocks()— allocation trackingxmlMemDisplay()/xmlMemShow()— debugging output
§Phase 1 status
Complete — all allocator APIs are implemented with thread-safe global state.
§Safety
Allocator hooks are unsafe because they operate on raw pointers and are called
from C code. Every public function documents its safety contract.
Functions§
- xmlCleanup
Memory - Clean up the memory layer.
- xmlFree⚠
- Free allocated memory.
- xmlGc
MemGet ⚠ - Get GC-aware memory allocator functions.
- xmlGc
MemSetup ⚠ - Set GC-aware memory allocator functions.
- xmlInit
Memory - Initialize the memory layer with debugging support.
- xmlMalloc⚠
- Allocate memory.
- xmlMalloc
Atomic ⚠ - Allocate memory that will never contain pointers to other memory.
- xmlMalloc
Atomic ⚠Zero - Allocate zero-initialized memory (atomic variant).
- xmlMalloc
Zero ⚠ - Allocate zero-initialized memory.
- xmlMem
Blocks - Return the current number of allocated blocks (approximate).
- xmlMem
Display ⚠ - Display memory allocation information to a file.
- xmlMem
Get ⚠ - Get the current memory allocator functions.
- xmlMem
Setup ⚠ - Set custom memory allocator functions.
- xmlMem
Show ⚠ - Show memory allocation information.
- xmlMem
Strdup ⚠ - Duplicate a C string using the configured allocator.
- xmlMem
Used - Return the total amount of memory currently allocated (approximate).
- xmlRealloc⚠
- Reallocate memory.
- xmlRealloc
Zero ⚠ - Reallocate and zero-initialize the new portion.