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

Memory management in ORB implementation

6 views
Skip to first unread message

Joost Kraaijeveld

unread,
Nov 23, 2009, 9:33:43 AM11/23/09
to
Hi,

I am curious about the memory management in an ORB implementation. If an
interface returns a pointer (_ptr) to an object that is part of an ORB's
implementation, who owns that pointer and is responsible for the
deletion of that pointer, e.g. a pointer returned from
orb->resolve_initial_references()? Or are all the local objects
reference counted somehow and is the callee responsible for bumping the
reference count so that the caller can safely store the pointers in a _var?

Or is there a kind soul somewhere with a pointer to some docs where I
can read about the memory management of an ORB implementation?

TIA

Joost

Joost Kraaijeveld

unread,
Nov 24, 2009, 6:53:53 AM11/24/09
to
Hi Douglas,


On Mon, 2009-11-23 at 15:50 -0600, Douglas C. Schmidt wrote:
> http://www.omg.org/technology/documents/formal/c++.htm
>
> for the CORBA C++ language mapping specification, which explains how
> all of this stuff works.

I have read the specification but I could not find an authoritative
answer, hence the question.

Maybe I was not clear enough but I was talking about the implementation
of the ORB itself. In that context I wondered who owns the pointer that
is returned from for example "resolve_initial_references": is it the
caller or the callee's responsibility to bump the reference count (if
any), should the caller use "delete" or "Corba::release" etc. I assume
that the callee bumps the reference count for reference counted object
so that the returned pointer can safely be stored in a _var without any
fuss. Is that correct?

TIA

Joost

Johnny Willemsen

unread,
Nov 24, 2009, 7:46:00 AM11/24/09
to
Hi,

In the past there was no reference counting for local objects, the 1.2 C++
mapping did change this, local objects are now reference counted by default.
That is something we changed in TAO some time ago

Johnny
www.theaceorb.nl

"Joost Kraaijeveld" <J.Kraa...@Askesis.nl> wrote in message
news:4b0a9d5e$0$6347$e4fe...@dreader16.news.xs4all.nl...

Duncan Grisby

unread,
Nov 24, 2009, 8:07:10 AM11/24/09
to
In article <4b0a9d5e$0$6347$e4fe...@dreader16.news.xs4all.nl>,
Joost Kraaijeveld <J.Kraa...@Askesis.nl> wrote:

>I am curious about the memory management in an ORB implementation. If an
>interface returns a pointer (_ptr) to an object that is part of an ORB's
>implementation, who owns that pointer and is responsible for the
>deletion of that pointer, e.g. a pointer returned from
>orb->resolve_initial_references()? Or are all the local objects
>reference counted somehow and is the callee responsible for bumping the
>reference count so that the caller can safely store the pointers in a _var?

The caller takes ownership of the object in that case, and is
responsible for releasing it.

>Or is there a kind soul somewhere with a pointer to some docs where I
>can read about the memory management of an ORB implementation?

The C++ mapping specification gives you all the rules:

http://www.omg.org/spec/CPP/1.2/

Cheers,

Duncan.

--
-- Duncan Grisby --
-- dun...@grisby.org --
-- http://www.grisby.org --

Douglas C. Schmidt

unread,
Nov 24, 2009, 8:56:47 AM11/24/09
to
Hi Joost,

>I have read the specification but I could not find an authoritative
>answer, hence the question.

Ok.

>Maybe I was not clear enough but I was talking about the implementation
>of the ORB itself. In that context I wondered who owns the pointer that
>is returned from for example "resolve_initial_references": is it the
>caller or the callee's responsibility to bump the reference count (if
>any), should the caller use "delete" or "Corba::release" etc. I assume
>that the callee bumps the reference count for reference counted object
>so that the returned pointer can safely be stored in a _var without any
>fuss. Is that correct?

Yes, that is correct. If you use the *_var types then there's no fuss
(for the typical/simple cases). If you use the *_ptr types, however,
then the caller is responsible for managing the memory via release().

Thanks,

Doug
--
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203 NET: d.sc...@vanderbilt.edu

0 new messages