PreviousNext

Using rpc_ss_allocate and rpc_ss_free in Manager Code

Manager code uses either the rpc_ss_allocate( ) and rpc_ss_free( ) routines or the operating system allocation and free routines to allocate and free memory.

Manager code uses rpc_ss_allocate( ) to allocate storage for data that the server stub is to send back to the client. Manager code can either use rpc_ss_free( ) to free the storage explicitly, or it can rely on the server stub to free it. After the server stub marshalls the output parameters, it releases any storage that the manager code has allocated with rpc_ss_allocate( ).

Manager code can also use the rpc_ss_free( ) routine to release storage pointed to by a full pointer in an input parameter and have the freeing of the memory reflected on return to the calling application if the reflect_deletions attribute has been specified as an operation attribute in the interface definition. See Interface Definition Language for instructions on how to declare the reflect_deletions operation attribute.

Manager code uses the operating system allocation routine to create storage for its internal data. The server stub does not automatically free memory that operating system allocation routines have allocated. Instead, manager code must use the operating system free routine to deallocate the memory explicitly before it exits.

When manager code makes a remote call, the default memory management routines are rpc_ss_allocate( ) and rpc_ss_free( ).