neo4j_memory_allocator Struct Reference

A memory allocator for neo4j client. More...

`#include <neo4j-client.h>`

## Data Fields

void *(* | alloc )(struct neo4j_memory_allocator *self, void *context, size_t size)
| Allocate memory from this allocator. More...
void *(* | calloc )(struct neo4j_memory_allocator *self, void *context, size_t count, size_t size)
| Allocate memory for consecutive objects from this allocator. More...
void(* | free )(struct neo4j_memory_allocator *self, void *ptr)
| Return memory to this allocator. More...
void(* | vfree )(struct neo4j_memory_allocator *self, void **ptrs, size_t n)
| Return multiple memory regions to this allocator. More...

## Detailed Description

A memory allocator for neo4j client.

This will be used to allocate regions of memory as required by a connection, for buffers, etc.

## Field Documentation

## alloc

void*(* neo4j_memory_allocator::alloc) (struct neo4j_memory_allocator *self, void *context, size_t size)

Allocate memory from this allocator.

Parameters

  [self] | This allocator.
  [context] | An opaque 'context' for the allocation, which an allocator may use to try an optimize storage as memory allocated with the same context is likely (but not guaranteed) to be all deallocated at the same time. Context may be `NULL`, in which case it does not offer any guidance on deallocation.
  [size] | The amount of memory (in bytes) to allocate.

Returns
  A pointer to the allocated memory, or `NULL` on error (errno will be set).

## calloc

void*(* neo4j_memory_allocator::calloc) (struct neo4j_memory_allocator *self, void *context, size_t count, size_t size)

Allocate memory for consecutive objects from this allocator.

Allocates contiguous space for multiple objects of the specified size, and fills the space with bytes of value zero.

Parameters

  [self] | This allocator.
  [context] | An opaque 'context' for the allocation, which an allocator may use to try an optimize storage as memory allocated with the same context is likely (but not guaranteed) to be all deallocated at the same time. Context may be `NULL`, in which case it does not offer any guidance on deallocation.
  [count] | The number of objects to allocate.
  [size] | The size (in bytes) of each object.

Returns
  A pointer to the allocated memory, or `NULL` on error (errno will be set).

## free

void(* neo4j_memory_allocator::free) (struct neo4j_memory_allocator *self, void *ptr)

Return memory to this allocator.

Parameters

  [self] | This allocator.
  [ptr] | A pointer to the memory being returned.

## vfree

void(* neo4j_memory_allocator::vfree) (struct neo4j_memory_allocator *self, void **ptrs, size_t n)

Return multiple memory regions to this allocator.

Parameters

  [self] | This allocator.
  [ptrs] | An array of pointers to memory for returning.
  [n] | The length of the pointer array.