Windows primitive memory leak

William O. Dargel wDargel at
Sun Jun 7 04:30:41 UTC 1998

I've found a memory leak in the FileDirectory primitive for Windows. You
can actually run into it just by moving around the directory hierarchy
in a FileList browser.

Every time FileDirectory>>primLookupEntryIn:index: is called it loses
memory. By looking at "Committed Bytes" in the Windows NT Performance
Monitor, I  found that it loses about 4KB each time when looking up a
directory entry on a local hard disk, and 20KB for a network drive. By
doing something like:
    1 to: 5000 do: [:i |
        FileDirectory default
            primLookupEntryIn: 'w:\smalltalk'
            index: 1]
you can just watch the memory usage ramp up, and might also reach a
point where it gets a "system primitive failed".

I'm not currently in a position to recompile the VM. But in looking at
dir_Lookup() in sqWin32Directory.c, I think that the problem might be
that there is no call to FindClose() on the normal return when an entry
is found.

Perhaps someone (Andreas?) could confirm this bug and then check out the
proposed solution.
Bill Dargel            wdargel at
Shoshana Technologies
100 West Joy Road, Ann Arbor, MI 48105  USA

More information about the Squeak-dev mailing list