Re: Memory management question
Jules Colding <[email protected]>
| Newsgroups | gmane.comp.gnome.orbit.general |
|---|---|
| Organization | OMC Denmark ApS |
| Message-ID | <[email protected]> |
On Fri, 2005-01-21 at 13:28 -0500, [email protected] wrote: > 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(). I read that same paragraph myself. I have come to believe, due to comments elsewhere about marshaling and freeing by the ORB, that the value must be copied before it is given to the ORB. I will appreciate an authoritative answer as the documentation is rather vague on this point. -- jules > Regards, > Nick G. > > > > > > Jules Colding <[email protected]> > Sent by: [email protected] > 01/21/2005 07:43 AM > > To: ORBit2 <[email protected]> > 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 > [email protected] > http://mail.gnome.org/mailman/listinfo/orbit-list >