Memory

Memory — Memory handling functions

Synopsis

void                raptor_free_memory                  (void *ptr);
void*               raptor_alloc_memory                 (size_t size);
void*               raptor_calloc_memory                (size_t nmemb,
                                                         size_t size);

Description

Wrappers around the free, malloc and calloc functions but called from inside the library. Required by some systems to handle multiple-HEAPs and pass memory to and from the library.

Details

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

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_parser_generate_id() handler code to create new strings that will be used internally as short identifiers and freed later on by the parsers.

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_parser_generate_id() handler code to create new strings that will be used internally as short identifiers and freed later on by the parsers.

nmemb :

number of members

size :

size of item

Returns :

the address of the allocated memory or NULL on failure


Navigation: Redland Home Page

Copyright 2000-2010 Dave Beckett