Re: NSPR/NSS memory leak
"Wan-Teh Chang" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.nspr |
|---|---|
| Message-ID | <[email protected]> |
On 9/25/07, Vinu <[email protected]> wrote: > Hi All, > > I have a dll in Windows which uses NSS 3.11.4 and NSPR 3.6.4. > The dll does a PR_Init during Load. > > Now, I have an application(.exe)which loads this dll dynamically using > LoadLibrary and then unloads it using FreeLibrary. > So after LoadLibrary and FreeLibrary I expect NO memory leak in my > application. > > But however i see an increase of 2 threads the moment a call to > PR_Init is made. And also there is a memory leak of 4K after > FreeLibrary. > > Can anybody guess if the NSPR library is completely deinitialized and > removed from memory when my above program calls FreeLibrary???? I > believe this should be the case. > > Also, If i call PR_Cleanup as part of my FreeLibrary(Dll Unload) > routine, then the whole application just hangs???? > > Can anyone help me out here! Hi Vinu, Use the "WIN95" build configuration. This will get rid of the 2 internal threads created by NSPR. Build NSS with OS_TARGET=WIN95 on the gmake command line, or set OS_TARGET=WIN95 as an environment variable before you run gmake. Unfortunately, PR_Cleanup does not yet free all the memory/resources used by NSPR. We are working towards that goal. According to Microsoft documentation, it is unsafe to call PR_Cleanup from DllMain on process detach because PR_Cleanup calls too many functions prohibited in DllMain. I don't know of a good solution. Perhaps we can register a _onexit handler that calls PR_Cleanup? Wan-Teh