Re: Server-side buffers
- From: Michael Meeks <michael helixcode com>
- To: Richard Andrews <richarda ixla com au>
- Cc: GNOME components list <gnome-components-list gnome org>
- Subject: Re: Server-side buffers
- Date: Wed, 6 Dec 2000 08:42:36 -0500 (EST)
Hi Richard,
On Wed, 6 Dec 2000, Richard Andrews wrote:
> In my server I'm implementing a stream write. I pass a buffer from the
> client to the server which is a CORBA_sequence_octet. I get a similar
> buffer out the other end in the impl_Stream_write()
Ok; the best way I have discovered to think about CORBA memory
allocation is to consider what happens in the fast bypass case. IE. the
skel is called immediately without any extra cleverness.
Consequently if you allocate a sequence you own the allocation,
that is until you 'return' it, either through an out param or by value
from a skel. At which point you don't. If you pass a sequence as an in
parameter then you still own its allocation.
> I assume that the client side sequence is automatically deallocated by
> the CORBA libs after being aborbed by Stream_write(). Is this correct?
No. You need to free it yourself; cf. bonobo-stream-client.c
(bonobo_stream_write). The slightly unfair thing about this is that we
stick a pointer of our own into the sequence and you have to know that
this will not be released ( by default ) in the CORBA_free (buf) [ cf.
Bonobo-common.c (CORBA_sequence_CORBA_octet__alloc)'s setting of release
].
> What is supposed to deallocate the buffer on the server-side? If it is
> my server code, how should I deallocate the memory? I tried calling
> CORBA_free(buffer) and this caused the server to seg-fault. I just
> want to avoid memory leaks.
Don't do that on the server side, do it on the client.
Regards,
Michael.
--
mmeeks gnu org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]