# Memory leaks fixing effort

## Viewer

- Startup (not the firsttime)
- Show default page
- Quit

Component | Leaks fixing by... | Status (nsIModule conversion)
--- | --- | ---
bin/Components/
caps.dll | rjc | DONE
chardet.dll | kipp | DONE
history.dll | dp | DONE
jsloader.dll | kipp | DONE
lwbrk.dll | kipp | DONE
necko.dll | kipp | DONE
necko_resource.dll | kipp | DONE
necko_file.dll | kipp | DONE
nsgif.dll | kipp | DONE
nslocale.dll | cata | DONE
mimetype.dll | rjc | DONE
oji.dll | rjc | DONE
profile.dll | dp | DONE
raptorhtml.dll | kipp | DONE
raptorview.dll | dp | DONE (doesnt cache factory)
rdf.dll | kipp | DONE
uconv.dll | cata | DONE
ucvlatin.dll | cata | DONE
ucharuti.dll | ftang | DONE
xpc3250.dll | kipp | DONE
xppref32.dll | dp | DONE
bin/
jsdom.dll |  |
raptorhtmlpars.dll | vidur | DONE
raptorgfxwin.dll |  |
raptorweb.dll |  |
raptorplugin.dll |  |
raptorwidget.dll |  |

## Apprunner only

Component | Leaks fixing by... | Status (nsIModule conversion)
--- | --- | ---
addrbook.dll | alecf | DONE
bookmarks.dll | rjc | DONE
brprof.dll | XXX | rjc says: This should be removed from build. See bug # 13732
chrome.dll | neeti | DONE
cnvts.dll | morse | DONE
cookie.dll | neeti | DONE
directory.dll | rjc | DONE
emitter.dll | alecf | DONE
ender.dll | morse | DONE
eventloop.dll | XXX - Don't do this |
intlcmpt.dll | cata | DONE
jar50.dll | neeti | DONE
jsurl.dll | morse | DONE
mime.dll | mscott | DONE
mork.dll | bienvenu | DONE
mozbrwsr.dll | alecf | DONE
mozfind.dll | alecf | DONE
mozucth.dll | alecf | DONE
mozxfer.dll | alecf | DONE
msgbase.dll | putterman | DONE
msgcompo.dll | alecf | DONE
msgdb.dll | bienvenu | DONE
msgimap.dll | mscott | DONE
msglocal.dll | mscott | DONE
msgnews.dll | alecf | DONE
nativeapp.dll | XXX - Don't do this |
necko_about.dll | kipp | DONE
necko_data.dll | kipp | DONE
necko_ftp.dll | kipp | DONE
necko_http.dll | kipp | DONE
nsjpg.dll | kipp | DONE
nspng.dll | kipp | DONE
nsprefm.dll | neeti | DONE
nsxpi.dll | neeti | DONE
pics.dll | neeti | DONE
prefwind.dll | alecf | DONE
rdfdomds.dll | neeti | DONE
regviewer.dll | neeti | DONE
related.dll | rjc | DONE
sample.dll | -sample- Don't do this one. |
search.dll | rjc | DONE
stremcnv.dll | morse | DONE
strres.dll | cata | DONE
txmgr.dll | morse | DONE
txtsvc.dll | morse | DONE
ucvcn.dll | cata | DONE
ucvja.dll | cata | DONE
ucvko.dll | cata | DONE
ucvtw.dll | cata | DONE
ucvtw2.dll | cata | DONE
vcard.dll | XXX - Don't do this |
wallet.dll | neeti | DONE
wlltvwrs.dll | neeti | DONE
xpctest.dll | neeti | DONE
xpiflash.dll | neeti | DONE

## How to fix leaks in a dll

### Stage 1: nsIModule conversion

1. Convert dll to use nsIModule. Sample code is in mozilla/xpcom/sample/nsSampleModule.cpp. Things to watch out for:

1. nsIModule::UnregisterSelf should not return an Error.
2. Cache factories created by modules in the module.

The sample code does all this right. So sticking to closely is adviced.

### Stage 2: Leak fixing (DONT DO THIS NOW)

1. While in purify run bin/TestShutdown on the dll. For this you will need to find a CID that the module implements. Then invoke TestShutdown as

TestShutdown {123d4-4908-490840-409850}

2. Make sure there are no leaks from the purify output.
Use ns<dll>Module::Shutdown() to release any global memory that is being leaked.