Free the memory allocated to the CORBA sequence

  • Follow


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
0
Reply ganesh.tambat (31) 4/21/2009 2:13:57 PM


Kasparov wrote:
> 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
0
Reply Raghu 4/21/2009 3:03:02 PM


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
jon@floorboard.com
jon@biggar.org
jonbiggar@gmail.com
0
Reply Jon 4/24/2009 4:29:21 AM

2 Replies
259 Views

(page loaded in 0.182 seconds)

Similiar Articles:













7/25/2012 5:30:22 AM


Reply: