<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt"><div><span>Hi Duncan,</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span><span style="font-family: monospace; font-size: 13px;">Then if invocations on the new</span><br clear="none" style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">location fail, omniORB retries with the original object reference.</span><br clear="none" style="font-family: monospace; font-size:
13px;"><span style="font-family: monospace; font-size: 13px;">That's important for various implementation repository approaches and</span><br clear="none" style="font-family: monospace; font-size: 13px;"><span style="font-family: monospace; font-size: 13px;">for object migration support.</span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span><span style="font-family: monospace; font-size: 13px;">>> What happens if invocations on the new location succeed? Is the original object reference "deallocated", I think this is what's missing</span></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: monospace; background-color: transparent; font-style: normal;"><span><span style="font-family: monospace; font-size: 13px;"><br></span></span></div><div style="color:
rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span>I am using VC++ VS2010 (omniORB version is 4.1.7 compiled using cygwin using VS10 configurations)</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span>It's probably better to provide code snippets and the trace log, so you can visualize easily:</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span>Code Snippet:</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande',
sans-serif; background-color: transparent; font-style: normal;">DECLARATIONS:</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>helloInterface::HelloInt_var<span class="Apple-tab-span" style="white-space:pre">                        </span>m_HelloObj;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CORBA::String_var<span class="Apple-tab-span" style="white-space:pre">                                                </span>m_ObjName;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CORBA::Object_var<span class="Apple-tab-span" style="white-space:pre">                                                </span>m_ObjContext;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CosNaming::NamingContextExt_var<span class="Apple-tab-span" style="white-space:pre">                        </span>m_RootContext;</div><div style="background-color:
transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CORBA::Object_var<span class="Apple-tab-span" style="white-space:pre">                                                </span>m_NSObj;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CORBA::ORB_var<span class="Apple-tab-span" style="white-space:pre">                                                        </span>m_ORB;</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;"><br></div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;">INITIALIZATION snippet:</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>//initialize ORB</div><div style="background-color:
transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CString lstr_Opt1 = "-ORBInitRef";</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CString lstr_NS = "NameService=" + TaskWork.m_CORBAURL;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CString lstr_Opt2 = "-ORBDefaultInitRef";</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>CString lstr_NSDefault = TaskWork.m_CORBAURL + "#services" ;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>//char *lc_argv[] = {lstr_Opt1.GetBuffer(), lstr_NS.GetBuffer(), lstr_Opt2.GetBuffer(), lstr_NSDefault.GetBuffer()} ;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>char *lc_argv[] =
{lstr_Opt1.GetBuffer(), lstr_NS.GetBuffer()} ;</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>int li_argc = (int)(sizeof(lc_argv)/sizeof(lc_argv[ 0 ]));</div><div style="background-color: transparent;"><br></div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>const char* options[][2] = {</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>{ "traceLevel", "11" }, </div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>{ "traceExceptions", "1" }, </div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>{ "traceInvocationReturns", "1" }, </div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">
                                                                </span>{ "offerBiDirectionalGIOP", "1" }, </div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>{ "nativeCharCodeSet", "UTF-8" }, </div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                                                </span>{ NULL, NULL }</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                                        </span> }; </div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>TaskWork.m_ORB = CORBA::ORB_init(li_argc, lc_argv, "omniORB4", options);</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>omniORB::installSystemExceptionHandler(NULL,&CTask_CORBAClientDriver::ExceptionHandler);</div><div style="background-color: transparent;"><span class="Apple-tab-span"
style="white-space:pre">        </span>omniORB::installTransientExceptionHandler(NULL,&CTask_CORBAClientDriver::TransientHandler);</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>omniORB::installCommFailureExceptionHandler(NULL,&CTask_CORBAClientDriver::CommExceptionHandler);</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">        </span>omniORB::setLogFunction(&CTask_CORBAClientDriver::omniOrbLog);</div><div><br></div><div>METHOD snippet:</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                        </span>TaskWork.m_NSObj = TaskWork.m_ORB->resolve_initial_references("NameService");</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                        </span>TaskWork.m_RootContext = CosNaming::NamingContextExt::_narrow(TaskWork.m_NSObj);</div><div
style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                        </span>if(CORBA::is_nil(TaskWork.m_RootContext)){</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                </span>CLogOut::OutputCORBALog("Naming Context ERROR"); </div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                        </span>} else {</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                </span>TaskWork.m_ObjContext = TaskWork.m_RootContext->resolve_str(TaskWork.m_ObjName);</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                </span>//Get and store the remote obj</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                </span>if (!CORBA::is_nil(TaskWork.m_ObjContext)) {</div><div style="background-color:
transparent;"><span class="Apple-tab-span" style="white-space:pre">                                        </span>TaskWork.m_HelloObj = helloInterface::HelloInt::_narrow(TaskWork.m_ObjContext);</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                        </span>if (!CORBA::is_nil(TaskWork.m_HelloObj)) {</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                                </span>Log.Format( "Remote Object Found: %s [%s]", TaskWork.m_CORBAURL, TaskWork.m_CORBAObjName);</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                                </span>CLogOut::OutputCORBALog( Log );</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                        </span>}</div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                                </span>}</div><div style="background-color:
transparent;"><span></span></div><div style="background-color: transparent;"><span class="Apple-tab-span" style="white-space:pre">                        </span>}</div><div style="background-color: transparent; color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-style: normal;"><br></div><div>omniORB Tracer log (custom logger set by using: omniORB::setLogFunction)</div><div><div>[2013/12/10 17:48:47.069] [omniORB TRACE] : omniORB: Creating ref to remote: key<NameService>. target id : IDL:omg.org/CORBA/Object:1.0. most derived id: .</div><div>[2013/12/10 17:48:47.069] [omniORB TRACE] : omniORB: Initial reference `NameService' resolved from -ORBInitRef argument / ORB registration..</div><div>[2013/12/10 17:48:47.070] [omniORB TRACE] : omniORB: AsyncInvoker: thread id = 1 has started. Total threads = 1.</div><div>[2013/12/10 17:48:47.519] [omniORB TRACE] :
omniORB: Creating ref to remote: key<ッォヒ.......B.................RootPOA.....TNameService.................>. target id : IDL:omg.org/CORBA/Object:1.0. most derived id: IDL:omg.org/CosNaming/NamingContextExt:1.0.</div><div>[2013/12/10 17:48:47.519] [omniORB TRACE] : omniORB: Finish '_is_a' (location forward).</div><div>[2013/12/10 17:48:47.520] [omniORB TRACE] : omniORB: GIOP::LOCATION_FORWARD -- retry request..</div><div>[2013/12/10 17:48:47.523] [omniORB TRACE] : omniORB: Return '_is_a' on remote: key<ッォヒ.......B.................RootPOA.....TNameService.................>.</div><div>[2013/12/10 17:48:47.523] [omniORB TRACE] : omniORB: Creating ref to remote: key<ッォヒ.......B.................RootPOA.....TNameService.................>. target id : IDL:omg.org/CosNaming/NamingContextExt:1.0. most derived id: .</div><div>[2013/12/10 17:48:47.524] [omniORB TRACE] : omniORB: Creating
ref to remote: key<ッォヒ.....レ.タ..............>. target id : IDL:omg.org/CORBA/Object:1.0. most derived id: RMI:helloInterface.HelloInt:0000000000000000.</div><div>[2013/12/10 17:48:47.525] [omniORB TRACE] : omniORB: Return 'resolve_str' on remote: key<ッォヒ.......B.................RootPOA.....TNameService.................>.</div><div>[2013/12/10 17:48:47.525] Remote Object Found: corbaname::localhost:1055 [HelloIIOP]</div><div>[2013/12/10 17:48:47.525] [omniORB TRACE] : omniORB: LocateRequest to remote: key<ッォヒ.....レ.タ..............>.</div><div>[2013/12/10 17:48:47.528] [omniORB TRACE] : omniORB: Return 'sayHello' on remote: key<ッォヒ.....レ.タ..............>.</div><div>[2013/12/10 17:48:47.529] Remote Object Return Value : Hello World</div><div>[2013/12/10 17:48:48.414] [omniORB TRACE] : omniORB: Return 'sayHello' on remote:
key<ッォヒ.....レ.タ..............>.</div><div>[2013/12/10 17:48:48.414] Remote Object Return Value : Hello World</div><div>[2013/12/10 17:48:49.398] [omniORB TRACE] : omniORB: Return 'sayHello' on remote: key<ッォヒ.....レ.タ..............>.</div><div>[2013/12/10 17:48:49.398] Remote Object Return Value : Hello World</div><div>[2013/12/10 17:48:50.397] [omniORB TRACE] : omniORB: Return 'sayHello' on remote: key<ッォヒ.....レ.タ..............>.</div><div>[2013/12/10 17:48:50.397] Remote Object Return Value : Hello World</div><div>[2013/12/10 17:48:50.668] [omniORB TRACE] : omniORB: Preparing to shutdown ORB..</div><div>[2013/12/10 17:48:50.669] [omniORB TRACE] : omniORB: Shutting-down all incoming endpoints..</div><div>[2013/12/10 17:48:50.669] [omniORB TRACE] : omniORB: ORB shutdown is complete..</div><div>[2013/12/10 17:48:50.669] [omniORB TRACE] : omniORB:
Deinitialising omniDynamic library..</div><div>[2013/12/10 17:48:50.670] [omniORB TRACE] : omniORB: AsyncInvoker: thread id = 1 has exited. Total threads = 1.</div><div>[2013/12/10 17:48:50.670] [omniORB TRACE] : omniORB: AsyncInvoker: deleted..</div><div>[2013/12/10 17:48:50.670] CORBA Object Closed...</div><div>[2013/12/10 17:48:50.670] ORB Destroyed...</div><div><br></div><div>Visual Studio 2010 partial output log indicating the leak:</div><div><div>Detected memory leaks!</div><div>Dumping objects -></div><div>{55607} normal block at 0x00B1E300, 100 bytes long.</div><div> Data: <@ニ>[ Ww > 40 C6 3E 5B 20 57 77 00 FF FF FF FF 00 00 00 00 </div><div>Object dump complete.</div><div><br></div></div></div><div>Other notes:</div><div>Whenever a remote object is referenced, that too is causing leaks, but I found a way to cleanup the leaks by incorporating some extra code, see below (maybe the "allocation
for every reference" is by design and is included in the CORBA specs, but I used a _var (smart pointer) which has been discussed as "self-cleaning / self-deallocating" during destruction, yet it is leaving behind leaks)</div><div> CString* lClientRequest = (CString*)RecvParam.m_pPtr; <div><span class="Apple-tab-span" style="white-space:pre">                </span>if (!TaskWork.m_ORB->_NP_is_nil() && !TaskWork.m_ORB->_non_existent() && !TaskWork.m_HelloObj->_is_nil()) {</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>// Get the object's "storage location" so you can free it later (every time it is "referenced" a new allocation is made)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>CORBA::WStringValue* l_sayHelloPtr = TaskWork.m_HelloObj->sayHello();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>// Process all you want</div><div><span
class="Apple-tab-span" style="white-space:pre">                        </span>*lClientRequest = l_sayHelloPtr->_boxed_out();</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>CString Log;</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>Log.Format( " Remote Object Return Value : %s", *lClientRequest);</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>CLogOut::OutputCORBALog( Log );</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>// Cleanup to avoid leaks (this simply releases a reference, so that the object can clean/deallocate itself)</div><div><span class="Apple-tab-span" style="white-space:pre">                        </span>CORBA::WStringValue_Helper::remove_ref(l_sayHelloPtr); // >> NOT DOING THIS WILL CAUSE LEAKS</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div><br></div><div>If you need anything else please let me know. Hope you
can shed light on what am I doing wrong, or if indeed this is a bug (we can currently tolerate this as it is just causing a 100-byte leak, but leak is a leak, we want code which 100% clean). Thanks!</div><div><br></div><div>Regards,</div><div>Miff</div></div><div class="yahoo_quoted" style="display: block;"> <br> <br> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Wednesday, December 11, 2013 6:48 AM, Duncan Grisby <duncan@grisby.org> wrote:<br> </font> </div> <blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div class="y_msg_container">On Tue, 2013-12-10 at 18:38 +0800, Mifflin Mabalot wrote:<div class="yqt0166611481" id="yqtfd39264"><br clear="none"><br
clear="none">> I think there is a bug on CosNaming::NamingContextExt::_narrow. When<br clear="none">> an omniORB::LOCATION_FORWARD happens, the initially allocated object<br clear="none">> gets orphaned when trying to do a "GIOP::LOCATION_FORWARD -- retry<br clear="none">> request.." I think cleanup of the initially allocated object should<br clear="none">> be done inside omni::locationForward()</div><br clear="none"><br clear="none">What exactly are the circumstances, and what makes you think there is a<br clear="none">leak?<br clear="none"><br clear="none">By design, when an invocation returns with a location forward, omniORB<br clear="none">remembers the original object reference. Then if invocations on the new<br clear="none">location fail, omniORB retries with the original object reference.<br clear="none">That's important for various implementation repository approaches and<br clear="none">for object migration
support.<br clear="none"><br clear="none">Duncan.<br clear="none"><br clear="none">-- <br clear="none"> -- Duncan Grisby --<br clear="none"> -- <a shape="rect" ymailto="mailto:duncan@grisby.org" href="mailto:duncan@grisby.org">duncan@grisby.org</a> --<br clear="none"> -- <a shape="rect" href="http://www.grisby.org/" target="_blank">http://www.grisby.org </a><div class="yqt0166611481" id="yqtfd57361">--<br clear="none"><br clear="none"><br clear="none"></div><br><br></div> </blockquote> </div> </div> </div> </div></body></html>