section-memory: Raptor RDF Syntax Library Manual

## section-memory section-memory |

## Functions

void | raptor_free_memory ()
void * | raptor_alloc_memory ()
void * | raptor_calloc_memory ()

## Description

## Functions

### raptor_free_memory ()

    void
    raptor_free_memory (void *ptr);

Free memory allocated inside raptor.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory allocated by raptor to be freed.

Examples include the result of the '_to_' methods that returns allocated memory such as raptor_uri_filename_to_uri_string, raptor_uri_filename_to_uri_string and raptor_uri_uri_string_to_filename_fragment

#### Parameters

ptr | memory pointer |

### raptor_alloc_memory ()

    void *
    raptor_alloc_memory (size_t size);

Allocate memory inside raptor.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory to be allocated inside the raptor shared library that can be freed inside raptor either internally or via raptor_free_memory.

Examples include using this in the `raptor_world_generate_bnodeid()` handler code to create new strings that will be used internally as short identifiers and freed later on by the parsers.

#### Parameters

size | size of memory to allocate |

#### Returns

the address of the allocated memory or NULL on failure

### raptor_calloc_memory ()

    void *
    raptor_calloc_memory (size_t nmemb,
                          size_t size);

Allocate zeroed array of items inside raptor.

Some systems require memory allocated in a library to be deallocated in that library. This function allows memory to be allocated inside the raptor shared library that can be freed inside raptor either internally or via raptor_free_memory.

Examples include using this in the `raptor_world_generate_bnodeid()` handler code to create new strings that will be used internally as short identifiers and freed later on by the parsers.

#### Parameters

nmemb | number of members |
size | size of item |

#### Returns

the address of the allocated memory or NULL on failure