Cookbook Chapter 8: Using Custom Memory Allocators.
This example demonstrates how to integrate infix with a custom memory manager. This is useful for applications that need to track allocations, use a memory pool, or integrate with a garbage collector.
The recommended mechanism is infix_set_allocator(), which redirects all of infix's internal heap allocations to your callbacks at runtime. (A compile-time alternative, defining the infix_malloc/infix_free/etc. macros before including infix.h, is also supported for builds from source.)