High Performance OPC UA Server SDK  1.2.0.193
memory

Modules

 memory_layout
 Functions for managing the memory layout.
 
 mempool
 Dynamic memory allocator inspired by Doug Lea.
 
 objectpool
 Allocator for fixed size memory chunks.
 

Macros

#define size_align(size, alignment)   (((size) + (alignment) - 1) / (alignment) * (alignment))
 This rounds up the given size to a multiple of alignment. More...
 
#define ipc_malloc(size)   memory_malloc(size)
 Allocate dynamic memory from IPC memory.
 
#define ipc_free(ptr)   memory_free(ptr)
 Free dynamic memory from IPC memory.
 
#define ipc_calloc(nmemb, size)   memory_calloc(nmemb, size)
 Allocate zero initialized dynamic memory of nmemb * size from IPC memory.
 
#define ipc_realloc(ptr, size)   memory_realloc(ptr, size)
 Rellocate dynamic memory from IPC memory.
 
#define ipc_memset(s, c, n)   ua_memset(s, c, n)
 Fill IPC memory with constant byte c.
 
#define IPC_CLEANUP_MEM_ON_ERROR(ret, ptr)
 On error (ret != 0) free dynamic IPC memory and set pointer to NULL. More...
 
#define IPC_CLEANUP_MEM(ptr)   {ipc_free(ptr); ptr = NULL;}
 Free dynamic IPC memory and set pointer to NULL.
 
#define IPC_ALLOC(var)   ipc_malloc(sizeof(*var))
 Allocate dynamic IPC memory for a typed pointer var. More...
 
#define IPC_ALLOC_ARRAY(var, num)   ipc_malloc(sizeof(*var)*(num))
 Allocate array of dynamic IPC memory for a typed pointer var. More...
 
#define IPC_CALLOC(var)   ipc_calloc(1, sizeof(*var))
 Allocate zero initialized dynamic IPC memory for a typed pointer var. More...
 
#define IPC_CALLOC_ARRAY(var, num)   ipc_calloc(num, sizeof(*var))
 Allocate zero initialized array of dynamic IPC memory for a typed pointer var. More...
 
#define IPC_FREE(var)   ipc_free(var)
 Free dynamic memory from IPC memory. More...
 
#define IPC_CLEAR(var)   ua_memset(var, 0, sizeof(*var))
 Set memory pointed to by typed pointer to zero.
 
#define IPC_CLEAR_ARRAY(var, num)   ua_memset(var, 0, sizeof(*var)*(num))
 Like IPC_CLEAR but for arrays.
 
#define IPC_MEMSET(var, val)   ua_memset(var, val, sizeof(*var))
 
#define IPC_MEMSET_ARRAY(var, val, num)   ua_memset(var, val, sizeof(*var)*(num))
 

Functions

void * pointer_align (void *ptr)
 This rounds up the given address to next valid aligned pointer address. More...
 
char * ipc_strdup (const char *s)
 String duplication using ipc_malloc. More...
 

Detailed Description

Macro Definition Documentation

#define IPC_ALLOC (   var)    ipc_malloc(sizeof(*var))

Allocate dynamic IPC memory for a typed pointer var.

1 struct ua_string *s = IPC_ALLOC(s);
#define IPC_ALLOC_ARRAY (   var,
  num 
)    ipc_malloc(sizeof(*var)*(num))

Allocate array of dynamic IPC memory for a typed pointer var.

1 uint32_t *x = IPC_ALLOC_ARRAY(x, 2);
2 if (x == NULL) goto error;
3 x[0] = 35;
4 x[1] = 43;
#define IPC_CALLOC (   var)    ipc_calloc(1, sizeof(*var))

Allocate zero initialized dynamic IPC memory for a typed pointer var.

#define IPC_CALLOC_ARRAY (   var,
  num 
)    ipc_calloc(num, sizeof(*var))

Allocate zero initialized array of dynamic IPC memory for a typed pointer var.

#define IPC_CLEANUP_MEM_ON_ERROR (   ret,
  ptr 
)
Value:
if (ret != 0) { \
ipc_free(ptr); \
ptr = NULL; \
}
#define ipc_free(ptr)
Free dynamic memory from IPC memory.
Definition: memory.h:61

On error (ret != 0) free dynamic IPC memory and set pointer to NULL.

#define IPC_FREE (   var)    ipc_free(var)

Free dynamic memory from IPC memory.

#define size_align (   size,
  alignment 
)    (((size) + (alignment) - 1) / (alignment) * (alignment))

This rounds up the given size to a multiple of alignment.

Function Documentation

char* ipc_strdup ( const char *  s)

String duplication using ipc_malloc.

Behaves like the original strdup(), but allocates new memory with ipc_malloc.

void* pointer_align ( void *  ptr)

This rounds up the given address to next valid aligned pointer address.