Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Free the memory allocated to the CORBA sequence

83 views
Skip to first unread message

Kasparov

unread,
Apr 21, 2009, 10:13:57 AM4/21/09
to
I have a basic CORBA question.

On my CORBA server I have allocated memory for an out parameter of
type CORBA sequence. I have used c++ "new" to allocate the memory. Now
I want to make sure that the memory gets freed so how should I go
about that ?

- Should the client notify the server that it has received the value
of the out parameter and now the server can free the memory.

or

- CORBA will free the memory allocated to the sequence automatically
and I don't need to worry about freeing the memory.

Thanks in advance.
Ganesh

Raghu V. Hudli

unread,
Apr 21, 2009, 11:03:02 AM4/21/09
to Kasparov

In CORBA all parameters are owned by the calling code. Your code on
server side is called by the ORB runtime, which will free the space
allocated by your implementation. When you are done using the sequence
on the client side, simply release it. You do not need to worry about
releasing the memory on the server side. However, to ensure that your
code works correctly, use the allocbuff method in the sequence class.

Raghu

Jon Biggar

unread,
Apr 24, 2009, 12:29:21 AM4/24/09
to
Raghu V. Hudli wrote:
> In CORBA all parameters are owned by the calling code. Your code on
> server side is called by the ORB runtime, which will free the space
> allocated by your implementation. When you are done using the sequence
> on the client side, simply release it. You do not need to worry about
> releasing the memory on the server side. However, to ensure that your
> code works correctly, use the allocbuff method in the sequence class.

Using "new" is correct for the sequence object itself. "allocbuf" is
used to allocate a buffer for the sequence object to use as storage, and
is often unnecessary.

--
Jon Biggar
j...@floorboard.com
j...@biggar.org
jonb...@gmail.com

0 new messages