# Startup and Memory Management APIs for C and C++

The Startup and Memory Management APIs are used to initialize or free the global resources used by the program, and to create or free the memory used by the program elements.

This page contains information about the Startup and Memory Management APIs for C and C++, including the description and syntax, and the input, input types, input description, and input return values.

## na_startup

### Prototype

int na_startup(char* errbuff, int errbuffsize);

### Description

Initializes the global resources.

You must call this function before invoking any API.

Input | Type | Description
errbuffsize | int | The length of errbuff.

Output | Type | Description
errbuff | char* | In case of an error, a message is written into the buffer.

### Return value

- 1 (TRUE) on success

- 0 (FALSE) on failure

[top]

## na_shutdown

### Prototype

void na_shutdown(void);

### Description

Frees the system resources

### Return value

None

[top]

## na_free

### Prototype

void na_free(const void* ptr);

### Description

Frees memory that is pointed to by ptr.

You should use this API to free any memory allocated by the na_* APIs, such as na_child_get_string_encrypted().

Input | Type | Description
ptr | const void* | The address of the memory to be freed.

### Return value

None

[top]

## na_elem_new

### Prototype

na_elem_t* na_elem_new(const char* name);

### Description

Allocates resource for a new element.

Input | Type | Description
name | const char* | The name of the element for which a resource is to be allocated.

### Return value

- The pointer to the allocated element

- NULL on failure

[top]

## na_elem_free

Prototype

void na_elem_free(na_elem_t* elt);

Description

Frees all resources used by the input output element elt.

Input | Type | Description
elt | na_elem_t * | The element memory to be freed.

### Return value

None