libmseed 3.1.3
The miniSEED data format library
Loading...
Searching...
No Matches
Memory Allocators

User-definable memory allocators used by library. More...

Data Structures

struct  LIBMSEED_MEMORY
 

Functions

void * libmseed_memory_prealloc (void *ptr, size_t size, size_t *currentsize)
 

Variables

LIBMSEED_MEMORY libmseed_memory
 
size_t libmseed_prealloc_block_size
 

Detailed Description

User-definable memory allocators used by library.

The global structure libmseed_memory contains three function pointers that are used for all memory allocation and freeing done by the library.

The following function pointers are available:

By default the system malloc(), realloc(), and free() are used. Equivalent to setting:

void *(* realloc)(void *, size_t)
Pointer to desired realloc()
Definition libmseed.h:1376
void(* free)(void *)
Pointer to desired free()
Definition libmseed.h:1377
void *(* malloc)(size_t)
Pointer to desired malloc()
Definition libmseed.h:1375
LIBMSEED_MEMORY libmseed_memory

Data Structure Documentation

◆ LIBMSEED_MEMORY

struct LIBMSEED_MEMORY

Container for memory management function pointers

Data Fields
void *(*)(size_t) malloc Pointer to desired malloc()
void *(*)(void *, size_t) realloc Pointer to desired realloc()
void(*)(void *) free Pointer to desired free()

Function Documentation

◆ libmseed_memory_prealloc()

void * libmseed_memory_prealloc ( void * ptr,
size_t size,
size_t * currentsize )
extern

Internal realloc() wrapper that allocates in libmseed_prealloc_block_size blocks

Preallocation is used by default on Windows and disabled otherwise.

Variable Documentation

◆ libmseed_memory

LIBMSEED_MEMORY libmseed_memory
extern

Global memory management function list

◆ libmseed_prealloc_block_size

size_t libmseed_prealloc_block_size
extern

Global pre-allocation block size.

When non-zero, memory re-allocations will be increased in blocks of this size. This is useful on platforms where the system realloc() is slow such as Windows.

Default on Windows is 1 MiB, otherwise disabled.

Set to 0 to disable pre-allocation.

See also
msr3_resize_buffer
mstl3_resize_buffers