[Ace-users] [tao-users] _duplicate on ORB

Douglas C. Schmidt schmidt at dre.vanderbilt.edu
Thu Dec 27 07:46:11 CST 2007


Hi,

>     My question is not specific to any ACE TAO version.
>     I have read many examples in the examples directory and also from "Advanced corba programming with c++" book.
>  
>     While creating a servant all examples do a _duplicate of the orb and store it in a member variable.
>     Why this duplicate is required? 

It's not required - it's just an idiom for simplifying memory management.

> Can we just keep a _ptr to ORB?

Sure - as long as you have strict control over when to delete the ORB.

>     I have not seen doing same while storing POA references. They are stored in _ptr. Why is this?

I don't think the POA references are passed as parameters as much as the
ORB references are.

>     What should be the general practice followed while storing ORB and POA references in objects as a member variables.

You should follow whatever pattern that (1) you understand and (2) prevents
memory leaks/corruption.

Doug



More information about the Ace-users mailing list