OSF DCE Application Development Guide--Core Components

Interface Definition Language
17.14.7.8.1 Allocating and Freeing Memory
Manager code within RPC servers usually uses the rpc_ss_allocate( ) routine to allocate
storage. Storage that is allocated by rpc_ss_allocate( ) is released by the server stub
after any output parameters have been marshalled by the stubs. Storage allocated by
other allocators is not released automatically but must be freed by the manager code.
When the manager code makes a remote call, the default memory management routines
are rpc_ss_allocate() and rpc_ss_free().
The syntax of the rpc_ss_allocate( ) routine is as follows:
idl_void_p_t rpc_ss_allocate (idl_size_t size);
The size parameter specifies the size of the memory allocated.
Note: In ANSI standard C environments, idl_void_p_t is defined as void * and in
other environments is defined as char *.
Use rpc_ss_free() to release storage allocated by rpc_ss_allocate( ). You 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 by specifying the reflect_deletions attribute as an operation_attribute. See
Section 17.4.1 for more information.
The syntax of the routine is as follows:
void rpc_ss_free (idl_void_p_t node_to_free);
The node_to_free parameter specifies the location of the memory to be freed.
17.14.7.8.2 Enabling and Disabling Memory Allocation
It may be necessary to call manager routines from different environments; for example,
when the application is both a client and a server of the same interface. In this case, the
same routine may be called both from server manager code and from client code. The
rpc_ss_allocate() routine, when used by the manager code to allocate memory, must be
initialized before its first use. The stub performs the initialization automatically. Code,
other than stub code, that calls a routine, which in turn calls rpc_ss_allocate(), first calls
the rpc_ss_enable_allocate( ) routine.
The syntax of the routine is as follows:
void rpc_ss_enable_allocate (void);
The environment set up by the rpc_ss_enable_allocate() routine is released by calling
the rpc_ss_disable_allocate( ) routine. This routine releases all memory allocated by
calls to rpc_ss_allocate( ) since the call to rpc_ss_enable_allocate() was made. It also
releases memory that was used by the memory management mechanism for internal
bookkeeping.
124245 Tandem Computers Incorporated 17 49