[omniORB] Cleaning up after string_to_object

Brian Neal bgneal at gmail.com
Thu Sep 1 14:00:17 BST 2011


Why not use CORBA::Object_var?  For example:

CORBA::Object_var obj = orb->string_to_object(s);

That's what the IDL to C++ mapping describes. I am not familiar with
the types _CORBA_ObjRef_Var, etc. Are those internal types used by
omniORB? If you stick to the mapping you'll be fine (and your code
will be more portable).

Regards,
BN

On Thu, Sep 1, 2011 at 12:45 PM, Pearl Rothman <prothman at gmail.com> wrote:
> I am storing the result in a _CORBA_ObjRef_Var. Should I be storing it in a
> _CORBA_ObjRef_Var* ? Then should I be calling delete on the
> _CORBA_ObjRef_Var* ?
>
> Thanks
> On Thu, Sep 1, 2011 at 10:44 AM, Brian Neal <bgneal at gmail.com> wrote:
>>
>> 2011/9/1 Pearl Rothman <prothman at gmail.com>:
>> > Hi,
>> >
>> > Is there a way for me to release memory of an object that was allocated
>> > using string_to_object but is no longer being used?
>>
>> If you are using C++, store the result of string_to_object() in a
>> *_var.  The _var will call CORBA::release() on the object reference
>> when the var goes out of scope. For more information, see the IDL to
>> C++ language mapping or the Henning & Vinoski book.
>>
>> Best,
>> BN
>
>



More information about the omniORB-list mailing list