[Enterprise Extensions only]

CORBA::release

Overview Releases resources associated with an object or pseudo-object reference.
Original class CORBA


Intended Usage

This method is intended to be used by client and server applications to release resources associated with object (or pseudo-object) references. CORBA::release() should be used regardless of whether the object is local or remote. A release does not necessarily perform a delete operation, and in general the delete operator should not be used for CORBA objects and pseudo-objects

When CORBA::release() is performed on a proxy to a remote implementation, the release() method only releases resources associated with the proxy; the remote implementation object is neither affected nor notified. When all resources associated with the proxy object are released, as determined by a reference count, the proxy object is automatically destroyed (but the remote object is unaffected). Likewise, when all local references to a local object are released, the object is automatically destroyed, regardless of how many remote (proxy) references to the object exist.

Managed objects are not destroyed when all their local references are released; instead, they are passivated and removed from memory when the Instance Manager determines the in-memory copy of the managed object is no longer needed.

The CORBA::release() method has different signatures for different types of objects and pseudo-objects.

See also the CORBA::Object::_duplicate() method, which is used to increase the reference count of an object reference. The _narrow() methods defined by the C++ bindings also do an implicit CORBA::Object::_duplicate().

IDL Syntax

  static void release(BOA_ptr p);
  static void release(ContextList_ptr p);
  static void release(Context_ptr p);
  static void release(Current_ptr p);
  static void release(Environment_ptr p);
  static void release(ExceptionList_ptr p);
  static void release(Exception_ptr p);
  static void release(NamedValue_ptr p);
  static void release(NV_ptr p);
  static void release(ORB_ptr p);
  static void release(Object_ptr p);
  static void release(Principal_ptr p);
  static void release(Request_ptr p);
  static void release(ServerRequest_ptr p);
  static void release(TypeCode_ptr p);

Input parameters

p
The object reference to be released.

Return values

None.

Example

  /* The following is a C++ example */
  #include "corba.h"
  #include <string.h>
  ...
  int main(int argc, char *argv[])
  {
    CORBA::Object_ptr objPtr;
    string str;
    /* Construct the string */
    CORBA::ORB_ptr op; /* assume op is initialized */
    /* Make string to object */
    objPtr = op->string_to_object(str);
    /* Proceed with objPtr */
    ...
    CORBA::string_free(string);
    CORBA::release(objPtr);
  }