[Am-info] Why does NT fail to release allocated memory?
Eric Lee Green
elgreen@iname.com
Sat, 8 Jan 2000 17:43:01 -0700
On Sat, 08 Jan 2000, Lewis A. Mettler wrote:
> Eric Lee Green wrote:
> > On Sat, 08 Jan 2000, Lewis A. Mettler wrote:
> > > This is not necessarily the case. However, if NT does not release all
> > > memory back to the available pool until program termination (regardless
> > > if free() is called or not), NT is poorly designed and can no longer be
> > > used.
> >
> > Note that Unix displays the exact same behavior. The "free()" call in most libc
> > implementations merely puts the freed block of memory into an internal "free"
> > list for use by future malloc() calls rather than return it to the operating
> > system. This is due to efficiency -- most programs use a fairly constant amount
> > of memory, and constantly calling the kernel to handle routine malloc/free
> > would be ridiculously expensive.
>
> Maybe it is just the inability of NT to use the virtual memory as it
> should.
That may indeed be a problem. The fundamental design of Windows NT as
described by Simon Cooke and others appears to require that some pieces of data
be "locked" into memory rather than be allowed to be swapped in or out. I
would ask, though, what service pack level you're running, and what
applications you're talking about.
Meanwhile, finding the location of your memory leak and detirmining whether it
was the OS or whether it was a runtime library that both of your programs used
would be an interesting question. Netscape Communicator on most Unix platforms
leaks because they linked it against a buggy version of the Motif GUI library,
for example. Without knowing even what computer language your program is
written in, it'd be hard to pinpoint what the problem is, and whether this is a
case of Microsoft deliberately putting stuff into their OS to make their own
programs run better than possible competitors' programs.
GIven that most Microsoft applications are bloated memory-leaking
monstrosities, I find it hard to believe, though :-(. If Microsoft had "rigged"
the OS, it's likely that their software would be more reliable than the
competition's -- which, in most cases, it is not. I can regularly get Word 97 to
GPF if I play with tables, for example -- while I've *NEVER* gotten WordPerfect
to die. Office has something like 80% market share, while WordPerfect Suite has
a little over 10% market share. Quality, obviously, is not the reason here.
> In my own application, I have it self terminate and restart after an
> appropriate period of time.
This is what the Apache web server does on Unix, for much the same reason.
--
Eric Lee Green e_l_green@hotmail.com
http://members.tripod.com/e_l_green/