|
infix
A JIT-Powered FFI Library for C
|
An example demonstrating the "shared arena" memory optimization. More...
Classes | |
| struct | Point |
| A simple struct with two doubles, often used to test pass-by-value on registers. More... | |
| struct | User |
Functions | |
| void | handle_point (const Point *p) |
| void | handle_user (const User *u) |
| int | main (void) |
An example demonstrating the "shared arena" memory optimization.
This file illustrates an advanced memory management technique in infix. It shows how to create a type registry (infix_registry_create_in_arena) and multiple trampolines (infix_forward_create_in_arena) within a single, user-provided memory arena.
This approach enables trampolines to share pointers to named type definitions rather than creating deep copies, which reduces memory consumption and can improve performance when creating many trampolines with the same signatures. The example also includes a control case to contrast this with the default deep-copying behavior.
| void handle_point | ( | const Point * | p | ) |
| void handle_user | ( | const User * | u | ) |
| int main | ( | void | ) |