Function ndpi_set_memory_alloction_functions
Defined in File ndpi_api.h
Function Documentation
-
void ndpi_set_memory_alloction_functions(void *(*__ndpi_malloc)(size_t size), void (*__ndpi_free)(void *ptr), void *(*__ndpi_calloc)(size_t nmemb, size_t size), void *(*__ndpi_realloc)(void *ptr, size_t size), void *(*__ndpi_aligned_malloc)(size_t alignment, size_t size), void (*__ndpi_aligned_free)(void *ptr), void *(*__ndpi_flow_malloc)(size_t size), void (*__ndpi_flow_free)(void *ptr))
Set custom memory allocation functions for nDPI’s general memory allocator.
This function is optional, but if used, it MUST be called before ANY other nDPI functions!!
The first 4 parameters are mandatory. If you want to set a custom allocator for aligned memory, you must specify
__ndpi_aligned_mallocand__ndpi_aligned_free, both If you want to set a custom allocator for flow memory, you must specify__ndpi_flow_mallocand__ndpi_flow_free, bothFlow memory can use a separate allocator from general memory for better memory management in high-throughput scenarios.
- Parameters:
__ndpi_malloc – Function pointer to the custom malloc implementation
__ndpi_free – Function pointer to the custom free implementation
__ndpi_calloc – Function pointer to the custom calloc implementation
__ndpi_realloc – Function pointer to the custom realloc implementation
__ndpi_aligned_malloc – Function pointer to the custom aligned allocation implementation
__ndpi_aligned_free – Function pointer to the custom aligned free implementation
__ndpi_flow_malloc – Function pointer to the custom allocation of flows
__ndpi_flow_free – Function pointer to the custom free of flows