Newbie : Garbage Collection of Sequences (Server Side)
- From: Mr C.A.Beazley <cbeazley hgmp mrc ac uk>
- To: orbit-list gnome org
- Subject: Newbie : Garbage Collection of Sequences (Server Side)
- Date: Tue, 6 Nov 2001 16:00:24 +0000
Hi,
I'm very new to CORBA and am using Orbit with the C mappings.
I'm trying to write a CORBA server which returns a large sequence of strings
to the client. I don't know before hand how large the sequence will be so I
am using a unbounded sequence
The problem I'm having is that once I've returned the sequence, I don't know
how get the server to free up the memory allocated to the sequence, which
results in large memory leakage.
Where do I put the the clean up code and how do I invoke it?
claude
P.S. The code I'm using is something like this:-
The function get_StringSequence returns a sequence of strings
IDL file:-
-------------------------------------
interface FOO{
typedef sequence<string> stringlist;
stringlist get_StringSequence();
};
-------------------------------------
an example of the code for the server implementation of the function
get_StringSequence is as follows
-----------------------------------------------------------
CORBA_sequence_CORBA_string *
get_StringSequence(PortableServer_Servant servant,CORBA_Environment *ev)
{
int count;
CORBA_sequence_CORBA_string *sequence;
sequence=CORBA_sequence_CORBA_string__alloc();
sequence->_buffer=CORBA_sequence_CORBA_string_allocbuf(1000);
sequence->_length=1000;
for(count=0;count<1000;++count){
sequence->_buffer[count] = CORBA_string_dup ("Hello World\n");
}
return sequence;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]