Main Page | Report this Page
Computers Forum Index  »  Computer - Object (Corba)  »  Free the memory allocated to the CORBA sequence...
Page 1 of 1    

Free the memory allocated to the CORBA sequence...

Author Message
Kasparov...
Posted: Tue Apr 21, 2009 2:13 pm
Guest
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...
Posted: Tue Apr 21, 2009 7:15 pm
Guest
Kasparov wrote:
Quote:
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

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...
Posted: Fri Apr 24, 2009 5:20 am
Guest
Raghu V. Hudli wrote:
Quote:
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
jon at (no spam) floorboard.com
jon at (no spam) biggar.org
jonbiggar at (no spam) gmail.com
 
 
Page 1 of 1    
All times are GMT
The time now is Mon Dec 07, 2009 10:49 am