PreviousNext

Memory Management

When called to handle a remote operation, RPC client stubs allocate and free memory by using whatever memory management scheme is currently in effect. The client code - the generic code that can be called from either RPC clients or RPC servers - can use DCE RPC stub support routines to control which memory management scheme the stubs will use.

If client code has not explicitly set the memory management routines, the RPC client stubs use the following defaults:

· When called from manager code, and the operation contains one or more parameters that are full or unique pointers, or the ACF enable_allocate attribute has been applied, the client stubs use the rpc_ss_allocate( ) and rpc_ss_free( ) routines.

· When called from any other context, the RPC client stubs use the operating system allocation and free routines (for example, malloc( ) and free( )) on POSIX platforms.

Note that the memory management scheme established, whether explicitly or by default, is on a per-thread basis.

RPC server stubs do not allocate memory. Instead, they rely on the manager code - the code that the server stubs call - to allocate it for them.

The following topics gives guidelines for how client code and manager code should use the various allocation and free routines provided with DCE.

Note: DCE provides two versions of DCE RPC stub support routines. The rpc_ss_*( ) routines raise an exception, while the rpc_sm_*( ) routines return an error status value. In all other ways, the routines are identical. It is generally recommended that you use the rpc_sm_*( ) routines instead of the rpc_ss_*( ) routines for compliance with the Application Environment Specification/Distributed Computing.

More:

Using the Memory Management Defaults

Using rpc_ss_allocate and rpc_ss_free

Using Your Own Allocation and Free Routines

Using Thread Handles in Memory Management