Hi All,<br><br>I have a problem with a server deallocation. I alloc a object in the server routine and return the ogbect with obj._retn();<br><br>when the client destruct the orb, the object allocating in the server routine is not be deallocated.<br>
<br>the idl is:<br><br>module test<br>{<br> interface p1<br> { <br> attribute string name;<br> };<br> interface p2<br> {<br> p1 function();<br> };<br>};<br><br>Server Routine relative P2 interface<br><br>test_p2_i::test_p2_i(){<br>
// add extra constructor code here<br>cout<<"Constructor p2"<<endl;<br>}<br>test_p2_i::~test_p2_i(){<br> // add extra destructor code here<br> cout<<"destructor p2"<<endl;<br>
}<br>// Methods corresponding to IDL attributes and operations<br>test::p1_ptr test_p2_i::function(){<br> // insert code here and remove the warning<br> test_p1_i * n=new test_p1_i; ------------------------------> HERE ALLOC THE OBJECT<br>
n->name("ALEX");<br> test::p1_var ret=n->_this();<br>return ret._retn();<br>}<br><br><br>Server Routine relative P1 interface:<br><br>test_p1_i::test_p1_i(){<br> // add extra constructor code here<br> cout<<"constructor Call"<<endl;<br>
}<br>test_p1_i::~test_p1_i(){<br> // add extra destructor code here<br> cout<<"Destructor Call"<<endl;<br>}<br>// Methods corresponding to IDL attributes and operations<br>void test_p1_i::nome(const char*){<br>
// insert code here and remove the warning<br> <br>}<br><br>char* test_p1_i::nome(){<br> // insert code here and remove the warning<br><br>}<br><br><br><br><br>CLIENT:<br><br> try {<br><br><br> CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);<br>
<br><br> if( argc != 2 ) {<br> cerr << "usage: eg2_clt <object reference>" << endl;<br> return 1;<br> }<br><br> CORBA::Object_var obj = orb->string_to_object(argv[1]);<br>
<br><br><br> test::p2_var p2=test::p2::_narrow(obj);<br><br> if( CORBA::is_nil(p2) ) {<br> cerr << "Can't narrow reference to type Echo (or it was nil)." << endl;<br> return 1;<br> }<br>
<br><br><br>test::p1_ptr l=p2->function();<br>l->nome();<br>CORBA::release(l);<br><br>orb->destroy();<br><br><br><br>AFTER the client run the destruct of p1 object is it not be called why? there is a bug or i make an error on implementing server/client?<br>
<br><br>Thanks <br>R!SC<br><br><br><br><br><br><br> <br>