Hi,two years ago we wrote an add-in task in C for the R5 version of Domino Server and everything worked right. Now we switched to R6 but we are facing a memory leak. First I used the very same exe (compiled and linked with the R5 libs), then I tried to rebuild the task with the 6.5.1, 6.5.2 and 6.5.3. I’ve tested with all the three versions of the server (6.5.1, 6.5.2 and 6.5.3) and in different operating system (Windows 2000 SP4, Windows 2003, Windows XP Pro) and the result is always the same: a memeory leak of more or less 40Kb of RAM each time I call NIFOpenCollection and NIFReadEntries.
The problem is that the collection is empty and NIFReadEntries returns a null buffer (as expected). But the two calls use each time 40Kb which is not returned when I call NIFCloseCollection.
Subject: Memory Leak NIFOpenCollection and NIFReadEntries
rebuilding capi applications with other capi-versions usually doesn’t change anything at all (it just provides infos for linker, there’s no code inside) the code itself resides in nnotes.dll (on win)…
all other handles are closes properly? (NIFCloseCollection, NSFDbClose, …).
memleaks in such basic functions are really rare (general memleaks in domino are rare as well). do you know for shure that you don’t encounter any caching? try to do same stuff 10000 times. still the same?
if you like you can send me the source, so i can have a look
Subject: RE: Memory Leak NIFOpenCollection and NIFReadEntries
Hi Mark,there is an update for the issue…
Without changing a single line of code and just playing with the MSVC6.0 compiler options we had resolved the problem with Domino 6.5.1 under Windows 2003.
The problems is still there for Windows XP Pro and (above all) Windows 2000 SP4 (our production environment).
I’ll send you by email the test application you can try to run to reproduce the problem. This is the application we have launched under the three OS.
We have tried also to build it with Visual Studio.NET…same result.
If now it works under Windows2003 does it mean the bug is in a windows API under Win2000 or XP?
Subject: Memory Leak NIFOpenCollection and NIFReadEntries: FIXED?
Hi Marcus,What do you mean for caching reasons?
We simply look at the task manager for the used mem.
Anyway for now the problem seems solved in all the three OS, but we had to modify the code (for Windows2003 changing compiling options solved the issue).
Basically the application (in the AddInIdle loop) performed a loop (once a second) where it called:
NIFOpenCollection
NIFUpdateCollection
NIFReadEntries
NIFCloseCollection
Under XP and W2000SP4 (not under W2003) this sequence generated a memory leak even when the Collection was empty. CloseCollection never returned the memory allocated from OpenCollection and ReadEntries.
What we did was to put the calls to NIFOpenCollection and NIFCloseCollection out of the AddInIdle loop and performing only UpdateCollection and ReadEntries inside the loop.