Re: Memory management question



I'm interested in this issue as well.  I see OMG's C language mapping 
addresses argument result passing.

The last paragraph of section 1.20 states:
   For operation results of type variable-length struct, variable-length 
union, wstring, string, sequence, array, or any, the ORB will allocate 
storage for the return value using the appropriate type-specific 
allocation function.  The client may use and retain that storage 
indefinitely, and must indicate when the value is no longer needed by 
calling the procedure CORBA_free().

Regards,
Nick G.





Jules Colding <colding omesc com>
Sent by: orbit-list-bounces gnome org
01/21/2005 07:43 AM
 
        To:     ORBit2 <orbit-list gnome org>
        cc: 
        Subject:        Memory management question


Hi,

I have an interface such as:

module BRUTUS {
                 union SRestriction {
                                 /* lots of variable sized stuff */
                 };

                 interface SRestrictionContainer {
                                 readonly attribute SRestriction content; 
                 }
};


The get_content() attribute method is defined as:

static BRUTUS_SRestriction 
*impl_BRUTUS_SRestrictionContainer__get_content(impl_POA_BRUTUS_SRestrictionContainer 
*servant,
  CORBA_Environment *ev)
{
        BRUTUS_SRestriction *retval;

        /* ------   insert method code here   ------ */
                 retval = &servant->attr_content;
        /* ------ ---------- end ------------ ------ */

        return retval;
}

So my question is now: Should I just return a pointer to attr_content as
I do above or should I make a copy of servant->attr_content ?


Thanks,
  jules

_______________________________________________
orbit-list mailing list
orbit-list gnome org
http://mail.gnome.org/mailman/listinfo/orbit-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]