Newsgroups: comp.windows.ms
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!mmshah
From: mmshah@athena.mit.edu (Milan M Shah)
Subject: Re: Out of resource in Windows 3?
Message-ID: <1991Apr30.031234.25226@athena.mit.edu>
Sender: news@athena.mit.edu (News system)
Organization: Massachusetts Institute of Technology
References: <1991Apr29.184300.13990@amd.com> <=hzg13n@rpi.edu> <3lzgb=p@rpi.edu>
Date: Tue, 30 Apr 91 03:12:34 GMT
Lines: 30

WRT running lots of apps on a machine with lots of memory and still running
out of resources, I believe the culprit is a type of resource called a handle.

In very general terms, a handle is a "magic cookie" that identifies all
types of windows objects. For example, if an app allocates a chuck of memory,
opens a application window, and creates a pop up menu, it *might* take up 
3 handles. When the application wants to manipulate the object, it identifies
it via the handle. Now, an application that displays lots of icons, like 
progman) might allocate a handle for each icon. 

Now, the main reason that people are running out of resources is that windows 
can allocate at most 8192 handles, from which it draws whatever *it* needs. 
Moreover, a lot of poorly written applications allocate handles but never 
release them, even after you quit the app. (For example, every time you select
the About... dialog box, most apps will allocate a handle. Quite a few never
bother to release the handle even after you are done with the dialog box).
These handles are lost until the next session. The severe limit on the
number of handles is hopefully going to be addressed in the next version of 
windows. 

One might think that one is never going to have 8192 objects (most of them
displayable). However, this is not the case; consider a naive implementation
of a spreadsheet, where each cell is its own window and has its own handle.

Hope this helps.

Milan
.
 

