OSF DCE Application Development Guide--Core Components

OSF DCE Application Development Guide—Core Components
The syntax of the rpc_ss_disable_allocate() routine is as follows:
void rpc_ss_disable_allocate (void);
17.14.7.9 Advanced Memory Management Support
Memory management may also involve setting and swapping the mechanisms used for
allocating and freeing memory. The default memory management routines are malloc( )
and free( ), except when the remote call occurs within manager code, in which case the
default memory management routines are rpc_ss_allocate( ) and rpc_ss_free( ).
17.14.7.9.1 Setting the Client Memory Mechanism
Use the rpc_ss_set_client_alloc_free( ) routine to establish the routines used in
allocating and freeing memory.
The syntax of the routine is as follows:
void rpc_ss_set_client_alloc_free (
idl_void_p_t (*p_allocate)(
idl_size_t size),
void (*p_free)(
idl_void_p_t ptr)
);
The p_allocate parameter points to a routine that has the same procedure declaration as
the malloc() routine, and is used by the client stub when performing memory allocation.
The p_free parameter points to a routine that has the same procedure declaration as the
free( ) routine, and is used by the client stub to free memory.
17.14.7.9.2 Swapping Client Memory Mechanisms
This routine exchanges the current client allocation and freeing mechanism for one
supplied in the call. The primary purpose of this routine is to simplify the writing of
modular routine libraries in which RPC calls are made. To preserve modularity, any
dynamically allocated memory returned by a modular routine library must be allocated
with a specific memory allocator. When dynamically allocated memory is returned by
an RPC call that is then returned to the user of the routine library, use
rpc_ss_swap_client_alloc_free(), before making the RPC call, to make sure the desired
memory allocator is used. Prior to returning, the modular routine library calls
rpc_ss_set_client_alloc_free() to restore the previous memory management
mechanism.
17 50 Tandem Computers Incorporated 124245