Sun Microsystems 5800 Computer Drive User Manual


 
Memory Usage
The 5800 system C client library generally follows the model of populating externally allocated
data structures such as handles, buers, 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
“Initializing a Global Session” on page 41).
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 Denitions
The C client library does not automatically refresh its in-memory schema denitions. If the
schema is changed through the command-line interface (CLI), a new session must be created
with a new call to
hc_session_create_ez” on page 53 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 dened as follows:
typedef void* (*allocator_t) (size_t size);
Heap Memory Deallocator
The heap memory deallocator is dened as follows:
typedef void (*deallocator_t) (void *p);
Heap Memory Reallocator
The heap memory reallocator is dened as follows:
typedef void (*reallocator_t) (void *p,size_t size);
Initializing a Global Session
The following function initializes a global session:
Overview ofthe5800 SystemCClient API
Chapter3 SunStorageTek 5800SystemCClient API 41