Grid Community Toolkit  6.2.1607800521 (tag: v6.2.20201212)
Functions

Memory Pool. More...

Functions

globus_bool_t globus_memory_init (globus_memory_t *mem_info, int node_size, int node_count)
 Initialize memory pool. More...
 
void * globus_memory_pop_node (globus_memory_t *mem_info)
 Retrieve a memory item from a pool. More...
 
globus_bool_t globus_memory_push_node (globus_memory_t *mem_info, void *buffer)
 Return a memory item to the pool. More...
 
globus_bool_t globus_memory_destroy (globus_memory_t *mem_info)
 Destroy a memory pool. More...
 

Detailed Description

Memory Pool.

The globus_memory abstraction implements a memory management pool for groups of same-sized data items.

Function Documentation

◆ globus_memory_destroy()

globus_bool_t globus_memory_destroy ( globus_memory_t *  mem_info)

Destroy a memory pool.

Free all the memory associated with the memory management structure. For every call to globus_memory_init() there should be a call to globus_memory_destroy() or else memory will leak.

◆ globus_memory_init()

globus_bool_t globus_memory_init ( globus_memory_t *  mem_info,
int  node_size,
int  node_count 
)

Initialize memory pool.

Initialize the globus memory management structure.

Before using any functions associate with a memory structure this function must be called.

Parameters
mem_infoThe memory management datatype
node_sizeThe size of the memory to allocated with each pop.
node_countThe initial number of nodes allocated with the memory management structure. If it is exceeded more will be allocated.

◆ globus_memory_pop_node()

void* globus_memory_pop_node ( globus_memory_t *  mem_info)

Retrieve a memory item from a pool.

Pop a chunk of memory out of the memory management structure. Similar to malloc(). When no longer using this item, return it to the pool via globus_memory_push_node().

◆ globus_memory_push_node()

globus_bool_t globus_memory_push_node ( globus_memory_t *  mem_info,
void *  buffer 
)

Return a memory item to the pool.

Push a chunk of memory back into the memory management structure. Similar to free().