infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
Ch08_SharedArena.c File Reference

An example demonstrating the "shared arena" memory optimization. More...

#include <infix/infix.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
Include dependency graph for Ch08_SharedArena.c:

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)
 

Detailed Description

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.

Function Documentation

◆ handle_point()

void handle_point ( const Point p)

◆ handle_user()

void handle_user ( const User u)

◆ main()

int main ( void  )