libsdfio 1.0.0
Reader and writer for ISO 25178-71 SDF surface data files in C
Loading...
Searching...
No Matches
sdfio_allocator Struct Reference

Memory management callbacks that replace malloc() and free(), for example with a pool or a bump allocator. More...

#include <types.h>

Data Fields

void * user
 Opaque pointer passed as the first argument of both callbacks.
void *(* allocate )(void *user, size_t size)
 Returns a block of at least size bytes, aligned for any object type, or null on failure.
void(* release )(void *user, void *memory)
 Releases a block returned by allocate.

Detailed Description

Memory management callbacks that replace malloc() and free(), for example with a pool or a bump allocator.

A header calls them when it is created. A handle calls them for all of its memory, and only when it is created and when a file is created or opened. Reading and writing allocate nothing, so a pool can be sized in advance.

The structure is frozen for the major version: it has these three fields and a new property of an allocator is a new function.

Examples
custom_allocator.c.

Field Documentation

◆ release

void(* sdfio_allocator::release) (void *user, void *memory)

Releases a block returned by allocate.

Never called with null.


The documentation for this struct was generated from the following file:
  • /home/runner/work/libsdfio/libsdfio/include/sdfio/types.h