OSF DCE Application Development Guide--Core Components
Topics in RPC Application Development
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( ).
16.1.2.2 Using rpc_ss_allocate and rpc_ss_free in Client Code
Client code may also want to use the rpc_ss_allocate() and rpc_ss_free() routines as
the stub memory management scheme. However, before client code can use
rpc_ss_allocate() and rpc_ss_free( ), it must first call the rpc_ss_enable_allocate()
routine, which enables the use of rpc_ss_allocate( ). If client code calls
rpc_ss_enable_allocate(), it must also call the rpc_ss_disable_allocate() routine
before it exits its thread to disable use of rpc_ss_allocate(). This routine releases all of
the memory allocated by calls to rpc_ss_allocate( ) in that thread since the call to
rpc_ss_enable_allocate() was made. As a result, client code can either free each piece
of allocated storage with rpc_ss_free(), or it can have rpc_ss_disable_allocate() free it
all at once when it disables the rpc_ss_allocate/free memory management scheme.
Before calling rpc_ss_enable_allocate(), client code must ensure that it has not been
called by code that has already set up the rpc_ss_allocate/free memory management
scheme. As a result, if the client code can ensure that it has not been called from a
manager routine, and it can ensure that any previous calls to rpc_ss_enable_allocate()
have been paired with calls to rpc_ss_disable_allocate(), it can safely call
rpc_ss_enable_allocate().
If client code cannot ensure that these conditions are true, it should check to make sure
the rpc_ss_allocate/free scheme has not already been set up. For example:
124245 Tandem Computers Incorporated 16−3