PreviousNext

rpc_ss_allocate(3rpc)

Allocates memory within the RPC stub memory management scheme

Used by server or possibly by client applications.

Synopsis

#include <dce/rpc.h>

idl_void_p_t rpc_ss_allocate (idl_size_t size);

Parameters

Input

size
Specifies, in bytes, the size of memory to be allocated.

Note that in ANSI standard C environments, idl_void_p_t is defined as void * and in other environments is defined as char *.

Description
Usually, the rpc_ss_allocate( ) routine is used in the manager code that is called from a server stub. Memory allocated by rpc_ss_allocate is released by the server stub after marshalling any output parameters at the end of the remote call in which the memory was allocated. If you want to release memory allocated by rpc_ss_allocate( ) before returning from the manager code use rpc_ss_free( ).

You can also use rpc_ss_free( ) in manager code to release memory pointed to by a full pointer (ptr) in an input parameter.

When the server uses rpc_ss_allocate( ), the server stub creates the environment the routine needs. If the parameters of the operation include any pointers other than those used for passing parameters by reference, the environment is set up automatically.

If you need to use rpc_ss_allocate( ) in a manager code routine that does not have a pointer in any of its parameters, use an ACF and apply the enable_allocate attribute to the relevant operation. This causes the generated server stub to set up the necessary environment.

Note that memory allocated by allocators other than rpc_ss_allocate( ) is not released when the operation on the server side completes execution.

If you want to use rpc_ss_allocate( ) outside the code called from a server stub, you must first create an environment for it by calling rpc_ss_enable_allocate( ).

See the OSF DCE Application Development Guide - Core Components for more information.

Return Values
A pointer to the allocated memory.

An exception, rpc_x_no_memory, when no memory is available for allocation.

Errors

The following describes a partial list of errors that might be returned. Refer to the OSF DCE Problem Determination Guide for complete descriptions of all error messages.

Related Information
Functions: rpc_ss_free(3rpc)

rpc_ss_enable_allocate(3rpc)

rpc_ss_disable_allocate(3rpc)

rpc_ss_get_thread_handle(3rpc)

rpc_ss_set_thread_handle(3rpc)