Sun Microsystems 5800 User Manual

Page of 136
Memory Usage
The 5800 system C client library generally follows the model of populating externally allocated
data structures such as handles, buffers, and result arrays.
Some internal data structures are generated during XML document construction. These data
structures are allocated and freed using the function pointers supplied to hc_init when
initializing the library (see
Other data structures are allocated and returned to the user; these have corresponding
functions to free them. For example, hc_session_create_ez and hc_session_free.
Updating Schema Definitions
The C client library does not automatically refresh its in-memory schema definitions. If the
schema is changed through the command-line interface (CLI), a new session must be created
with a new call to
to access the schema changes.
Session Management
A global session must be explicitly initialized with a call to hc_init and released with a call to
hc_cleanup
. Memory allocators and deallocators are supplied in the initialization function to
control how memory allocation occurs. You will normally supply the standard malloc, free,
and realloc functions for this functionality.
Heap Memory Allocator
The heap memory allocator is defined as follows:
typedef void* (*allocator_t) (size_t size);
Heap Memory Deallocator
The heap memory deallocator is defined as follows:
typedef void (*deallocator_t) (void *p);
Heap Memory Reallocator
The heap memory reallocator is defined as follows:
typedef void (*reallocator_t) (void *p,size_t size);
Initializing a Global Session
The following function initializes a global session:
Overview of the 5800 System C Client API
Chapter 3 • Sun StorageTek 5800 System C Client API
41