HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Provides global control over memory allocators

Typedefs

typedef void *(* exr_memory_allocation_func_t )(size_t bytes)
 Function pointer used to hold a malloc-like routine. More...
 
typedef void(* exr_memory_free_func_t )(void *ptr)
 Function pointer used to hold a free-like routine. More...
 

Functions

EXR_EXPORT void exr_set_default_memory_routines (exr_memory_allocation_func_t alloc_func, exr_memory_free_func_t free_func)
 Allow the user to override default allocator used internal allocations necessary for files, attributes, and other temporary memory. More...
 

Detailed Description

Typedef Documentation

typedef void*(* exr_memory_allocation_func_t)(size_t bytes)

Function pointer used to hold a malloc-like routine.

Providing these to a context will override what memory is used to allocate the context itself, as well as any allocations which happen during processing of a file or stream. This can be used by systems which provide rich malloc tracking routines to override the internal allocations performed by the library.

This function is expected to allocate and return a new memory handle, or NULL if allocation failed (which the library will then handle and return an out-of-memory error).

If one is provided, both should be provided.

See Also
exr_memory_free_func_t

Definition at line 161 of file openexr_base.h.

typedef void(* exr_memory_free_func_t)(void *ptr)

Function pointer used to hold a free-like routine.

Providing these to a context will override what memory is used to allocate the context itself, as well as any allocations which happen during processing of a file or stream. This can be used by systems which provide rich malloc tracking routines to override the internal allocations performed by the library.

This function is expected to return memory to the system, ala free from the C library.

If providing one, probably need to provide both routines.

See Also
exr_memory_allocation_func_t

Definition at line 177 of file openexr_base.h.

Function Documentation

EXR_EXPORT void exr_set_default_memory_routines ( exr_memory_allocation_func_t  alloc_func,
exr_memory_free_func_t  free_func 
)

Allow the user to override default allocator used internal allocations necessary for files, attributes, and other temporary memory.

These routines may be overridden when creating a specific context, however this provides global defaults such that the default can be applied.

If either pointer is 0, the appropriate malloc/free routine will be substituted.

This function does not fail.