Re: CORBA_string vs. g_new



Hi Dmitry,

You *MUST* use CORBA_string_alloc and CORBA_string_dup to allocate
CORBA strings. This is because they have to be intellegently free'd by
the ORB, and so they place special information about the allocation
directly before the string in memory. If you use g_new then this block
won't exist and the ORB won't be able to free the string.

N.B. if you are only using the string for an 'in' parameter to an
operation, then this isn't strictly necessary because the ORB never
needs to free the memory. Personally I'd still use it just to make the
code easier to read and use.

The 'everything' test which will be in the next release of ORBit
contains a string test which illustrates how CORBA_string_* should be
used.

Cheers,

Phil



Dmitry Yusupov writes:
 > Hi all!
 > 
 > 	Which benefits I'll get by using CORBA_string_alloc/CORBA_free, 
 > 	model against g_new/g_free?  And in which place of code ought to use 
 > 	CORBA_string class operations in my CORBA application?
 > 
 > -- 
 > Best regards,
 > Dmitry
 > 
 > _______________________________________________
 > 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]