Re: Structures and objects allocation



Hi Alessandro,

        Welcome to the ORBit community.

On Sun, 2 Dec 2001, Alessandro Mazzini wrote:
> I'm Alessandro and I'm working at a middleware for IPC with ORBit for
> my thesis: it's the first time I have to face with CORBA and I'm
> really finding a lot of problems. Please help me!

        Wow - this sounds really great :-) There's lots of valuable work
you can do inside the ORB.

        Firstly - can I encourage you to use ORBit2 - this involves
checkout out HEAD 'glib', 'linc' and 'ORBit2'

        ORBit2 is far more robust, correct and regression tested than
ORBit stable - and is significantly simpler and cleaner to read /
understand. There are also a number of documents in ORBit2/doc/ that would
be helpful for you - including a FAQ.

> With C mapping, sequences contain a var _buffer that needs to be
> allocated, and the idl compiler produces a function to do this:
> xxx_allocbuf(len). But: if I have nested sequences, the more external
> allocbuf() calls all the other internal functions?

        Yes that should be so I think; it will allocate the buffer full of
inline structures - but it cannot allocate any sub-sequences; so if you
have a sequence of sequences, you'll need to alloc their buffers with the
lengths you desire separately.

> Is it the same with deallocation? To deallocate I have to set the
> release flag to true and then call CORBA_free(): with nested sequences
> is it recursive? Or I need to set directly all the flags and call all
> tha CORBA_free()?

        Correct; with nested sequences CORBA_free is recursive - it
releases all the memory associated with the toplevel sequence. 100%
correct.

> And more: if the sequence is a sequence of Objects, to deallocate all
> the structure is it enough to call CORBA_free or should I do something
> else?

        Nope - just CORBA_free, but ensure that you CORBA_Object_duplicate
as you put the references into the sequence - since the CORBA_free
releases them ( obviously ).

> Thanks for the patience,

        No problem - in return, can you checkout ORBit2, especialy the FAQ
- and write simplified question / answers for your above questions - so
other people can learn without having to be brave enough to ask ? :-)

        Send a diff -u to the list is best.

        Regards,

                Michael.

-- 
 mmeeks@gnu.org  <><, Pseudo Engineer, itinerant idiot




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