eric zhang wrote:
> >   nsIServiceManager* service_manager;
> here you should use nsCOMPtr<nsIServiceManager> service_manager,using this
> smart pointer ,so you don't have to worry about possible memory leaking

Thanks for reply.

No, I should not use here nsCOMPtr<..>, better to say that I could but
not required to. Documentation clearly states this:
----
nsresult NS_InitXPCOM2(  nsIServiceManager** aResult, ...)
 aResult
    [out] ... The resulting interface pointer is AddRef'd upon return
and must *either be Release'd explicitly or passed to NS_ShutdownXPCOM*
when the application is finished with XPCOM.
....
----
So, the memory leaks are originating somewhere else.

-- 
With best regards, Igor.

_______________________________________________
dev-tech-xpcom mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-xpcom

Reply via email to