2-90
SOMobjects Base Toolkit: Programmer’s Reference Manual
somdReleaseResources Method
Purpose
Instructs a proxy object to release any memory it is holding as a result of a remote method
invocation in which a parameter or result was designated as “object-owned”.
IDL Syntax
void somdReleaseResources ();
Description
The somdReleaseResources method instructs a proxy object to release any memory it is
holding as a result of a remote method invocation in which a parameter or result was
designated as “object-owned”.
When a DSOM client program makes a remote method invocation, via a proxy, and the
method being invoked has an object-owned parameter or return result, the client-side
memory associated with the parameter/result will be owned by the caller’s proxy, and the
server-side memory will be owned by the remote object. The memory owned by the caller’s
proxy will be freed when the proxy is released by the client program. (The time at which the
server-side memory will be freed depends on the implementation of the remote object.)
A DSOM client can also instruct a proxy object to free all memory that it owns on behalf of
the client without releasing the proxy (assuming that the client program is finished using the
object-owned memory), by invoking the somdReleaseResources method on the proxy
object. Calling somdReleaseResources can prevent unused memory from accumulating in
a proxy.
For example, consider a client program repeatedly invoking a remote method “get_string”,
which returns a string that is designated (in SOM IDL) as “object-owned”. The proxy on
which the method is invoked will store the memory associated with all of the returned
strings, even if the strings are not unique, until the proxy is released. If the client program
only uses the last result returned from “get_string”, then unused memory accumulates in the
proxy. The client program can prevent this by invoking somdReleaseResources on the
proxy object periodically (for example, each time it finishes using the result of the last
“get_string” call).
Parameters
receiver A pointer to the SOMDClientProxy object to release resources.
ev A pointer to the Environment structure for the method call.
Example
string mystring;
...
/* remote invocation of get_string on proxy x,
* where method get_string has the SOM IDL modifier
* ”object_owns_result”.
*/
mystring = X_get_string(x, ev);
/* ... use mystring ... */
/* when finished using mystring, instruct the
* proxy that it can free it.
*/
_somdReleaseResources(x, ev);
Kommentare zu diesen Handbüchern