QUOTE (eidenk @ Oct 01 2007, 03:18 AM)
My bottleneck when using Windows ME are the resources.
I have nearly 2GB of RAM. I can run scores of processes at once without stabilty issues. All this works very
well just only sometimes I am stuck for lack of resources because I open too many apps at once or too
many plugins in certain audio applications I use.
So that I am after a patch that could significantly increase the size of the 32bit segments of the resources.
QUOTE (dencorso @ Oct 12 2007, 01:04 AM)
I agree with eidenk: the resources problem (running too low on them too fast) is IMHO the major limitation
faced by us users of Win 9x/ME, and sure is worth looking at more closely. AFAIK, they are implemented
respectively in GDI.EXE/GDI32.DLL and USER.EXE/USER32.DLL. Some useful info about them is available
in now classic "Windows 95 System Programming Secrets" by Matt Pietrek.
QUOTE (galahs @ Oct 12 2007, 08:50 AM)
More information of Win9x system resources and its limitations here:
http://www.helpwithwindows.com/techfiles/win-resources.htmland below:
QUOTE (Al Fasoldt @ Apr 15 2001)
Why the memory problem in Windows 95, 98 and Me isn't fixableCopyright © 2001, Al Fasoldt
Copyright © 2001, The Syracuse Newspapers
The standard versions of Windows have a big problem handling memory. This is hardly news to most of
us who use Windows, but there's a hidden side to the problem that makes it worse than it might seem.
Even people who are otherwise knowledgeable about Windows miss the significance of the problem. The
basic flaw is bad enough -- Windows has only a tiny area of memory to keep track of what's going on --
but the hidden aspect is that the problem can't be fixed.
Crazy as it seems, this fatal flaw in Windows 95, Windows 98 and Windows Me is never going to go
away. No software utility can fix it. Neither MemTurbo nor RAM Idle, two of the most popular programs
that claim to fix Windows memory handling, do anything to fix the problem. Nothing will.
Keep that in mind the next time you see claims about programs that supposedly fix problems with
Windows. A software program can't fix this Windows memory flaw any more than a set of racing tires can
turn a Hyundai into a Ferrari. The design of Windows makes a fix impossible. Only a complete redesign of
Windows 95, Windows 98 and Windows Me would work -- and, in fact, that's what Microsoft is doing for
the next home version of Windows, which it plans to introduce later this year. That version is Windows XP.
Windows 95, Windows 98 and Windows Me are like big cars fitted with tiny gas tanks. They will run fine
for a while and then sputter to a stop when they use up their allotment of memory.
The memory I'm referring to isn't the standard kind of memory that all computers need to function properly. It's a special area of memory unique to Windows. It's called "resource" memory, where Windows
keeps its pointers to what's going on.
When that memory area gets full, Windows loses control. Your mouse might stoop responding or you'll find
that you can't close a window on your screen. You'll be stymied just trying to close programs, and your
Windows PC will freeze. You'll lose what you were working on.
Ready for the wacko part of this? This storage area is so small, so improbably tiny, that it's not even
expressed in megabytes. Your PC's hard drive probably has hundreds and hundreds of megabytes of
storage. (A megabyte is 1 million bytes, and a byte is the smallest unit of storage.) If it's a modern
computer, your PC's actual memory probably reaches all the way to 64 megabytes or more.
It sure would be great if Windows knew what to do with 64 megabytes for its resources. But let's not be so
greedy. It would be just fine if it knew how to deal with 32 megabytes. Or with 16 megabytes. Heck, I'd
settle for 8 megs. Or even 1.
But even 1 megabyte is out of the reach of Windows when it's dealing with resources. Want to hear the
really bad news about this resource memory? Windows 95, Windows 98 and Windows Me can't set aside
any more than 64 kilobytes for this vital storage. No matter how much memory your PC has -- and most
new ones have at least 64 megabytes of memory -- all that Windows can use for resources is 64 kilobytes
(usually called "64K").
This means Windows can only use one-tenth of 1 percent of the typical memory in a modern PC for the allimportant
function of keeping track of what's going on.
This is the bad news that seems to follow Windows users around like a toothache. I get dozens of letters a
week from Windows users looking for ways to keep their Windows 95, Windows 98 or Windows Me
computers from running out of memory and crashing. They often ask if memory-enhancing programs they
see on the Internet actually fix the problem.
The answer is no. The 64K limit in Windows 95, 98 and Me is a barrier that can't be taken down. No
program can change this. Adding more regular memory (adding RAM, in other words) won't fix it, either.
Rebooting (shutting down and starting up again) can help by clearing out resource memory. When resource
memory runs low again, reboot again.
Apart from rebooting, which hardly counts as a "fix," there is no way to cure this flaw in these versions of
Windows. If you want to run a version of Windows that handles memory properly, you have two current
choices -- Windows NT, an older version that is about to be retired, or Windows 2000, a new version I've
raved about in print and on TV. Or you can wait for Windows XP later this year.
With the introduction of Windows XP, which, because of Microsoft's nearly total monopoly on PC operating
systems, will show up on practically every new PC sold by the end of the year, Microsoft will at last be
making an advertised version of Windows that is reliable and able to keep running for weeks without the
need for rebooting. If you're not drawn to the Mac or to Linux through your frustrations with Windows 95,
Windows 98 and Windows Me, and if you're scared away by Microsoft's refusal to tell you that Windows
2000 actually exists, you will want to upgrade to Windows XP as quickly as possible.
QUOTE (fastlanephil @ Oct 14 2007, 02:16 PM)
galahs, dencorso, eidenk, rloew
From what I understand of the problem, in order to make Win 95-98-ME able to run (backward compatible with)
16-bit Win 3.X programs, they need to be able to operate in 16-bit mode. Thus the files, User.exe, User32.dll,
GDI.exe, and GDI32.dll limit the 16-bit system resource size to 64 kbyte. Likewise, there are three 32-bit system
resource limitations, 2 Mbyte each per this article (click "About System Resources" at the bottom):
http://www.mvps.org/serenitymacros/repair.htmlSome more reading on the subject:
http://www.aumha.org/win4/a/resource.htmQUOTE (rloew @ Oct 15 2007, 10:39 PM)
After reviewing the various documents and web sites relating to "resources", I have come to the following conclusions:
The two 16-Bit 64K Resources are the most serious limitation, but are probably not expandable without
breaking many programs. I suspect that 16-Bit pointers may be used by various programs, all of which would
need to be fixed. Tracking down all of the programs that would need to be patched could be very tedious, and
doing so for third-party programs would be prohibitive.
The three 32-Bit 2MB Resources probably can be expanded more easily as long as the programs that use it
are not hard coded to expect 2MB. All of the references, that I have read, insist that these resources do not get
depleted in any reasonable use. I am not sure how useful expanding them would be.
I have as yet to locate the actual owner of these resources, but I currently suspect KERNEL32.DLL maintains
them.
QUOTE (dencorso @ Oct 15 2007, 11:34 PM)
Yes, they are THE question! What I had been thinking on, for a long time now, would be more of a workaround than a fix proper: I imagined a ring 0 program, say, srfix.vxd, that took a snapshot of the 16-bit USER stack, just after boot and saved it somewhere. Then, when the user resources get too low, the user closes all running programs, except those that were running just after boot and triggers a hotkey, causing srfix.vxd to restore the saved snapshot, thus releasing any orfaned resources lost due to leaks related causes. Ideally, the initial snapshot taking should be automatic, but as it's really not obvious in which order startup programs will load,perhaps that too would need to be an user triggered event. And srfix.vxd might do it independently also for GDI. I'm fully aware that this is not more than a very brute force workaround, but it may be a start. Please let me know what you think of this.
QUOTE (fastlanephil @ Oct 16 2007, 03:04 AM)
Thanks for the input everybody

, I suppose that this is the real root of the system resource problem.
Note that in two bytes there are ((2 raised to the 8th power) squared =) 65536 possible combinations, thus there is only a 64K 16-bit heap size.
"...The resource table is essentially a big list of information about all the resources that are in memory at any
given time. So if an application tells Windows to load a resource, Windows finds an empty spot in this resource
table, and fills it in with the information about the resource that was just loaded. Now, instead of giving the
application a four-byte pointer to the resource, Windows can just tell the application where the resource is in
the table. If I tell Windows to load a window, and that window winds up taking the 383rd slot in the resource
table, Windows will tell me "Okay, I've loaded the resource, and it's #383." Since these 'index numbers' are
much smaller numbers than memory addresses, under this scheme, a resource's number can be stored in
only two bytes instead of four; when you only have a few megabytes of memory to work with, and lots of
resources being used, that's a huge improvement.
There's a problem with this scheme. There's only so many different possible values that you can store in a
certain number of bytes of computer memory, just like there's only so many different numbers you can write
down if you aren't allowed to use more than a certain number of digits. If you have four bytes of memory to
work with, you can store billions of different possible values in those four bytes. But if you only have two bytes,
there's only 65536 different numbers that you can store in those two bytes. So if you use two-byte numbers as
your resource identifiers, you can't have more than 65536 resources loaded into memory at one time; if you
loaded more than that, there'd be no way for programs to tell them apart. But on the computers of the day,
there'd be no way to fit more than a few thousand resources into memory at one time anyway. So this
limitation wasn't seen as being a problem, and the Windows designers went ahead and used the resource
table and two-byte resource identifiers.
Now, we leap ahead to the present day. Memory is incredibly cheap; the memory savings from using two-byte
resource numbers instead of four-byte pointers simply aren't significant anymore. There'd be more than
enough memory to hold hundreds of thousands of resources in memory at one time. But there's still only
65,536 different possible resource identifiers; so only that many resources can be loaded into memory at once.
Beyond that, you're out of resources, no matter how much memory you have left."
http://www2.whidbey.com/djdenham/Window_memory.htmQUOTE (rloew @ Oct 16 2007, 03:33 PM)
Dear Dencorso,
In addition to the issues you have already mentioned there are additional problems with this approach. I have
listed some of the more apparent ones below:
1. This approach does not help when you are in the middle of something and your resources run out. You
need to terminate everything before you can use
the Hotkey. You only avoid having to reboot, which would probably be a good idea by this time to clear out
other waste.
2. There is no guarantee that you can terminate ALL processes, or that some processes started after startup
must continue to run for proper operation afterwards.
3. When resources run out, the computer could be locked up. preventing you from using the Hotkey or
executing the srfix.vxd.
QUOTE (Drugwash @ Oct 17 2007, 07:41 AM)
As long as the resources discussion is still here, i'd like to come in with some thoughts, if I may. Please note
I'm no programmer so I may be talking nonsense, but hopefully some good idea could be hooked out of this.
Once the owner/maintainer of the resources is found, there could be added a hook that would maintain
multiple 16-bit heaps and a list of running applications, so when certain application requests a certain
resource, the hook could direct it to the correct heap.
Say 'application #5 requests resource #172' - the hook would know that the respective resource would be
found in heap #4, so it would redirect the request to the respective heap.
With multiple 16-bit heaps, I believe there would be no more resource problems. But what do I know... maybe
I'm far off. My apologies if so.

QUOTE (rloew @ Oct 18 2007, 02:29 AM)
Some Resources such as Windows can be accessed from more than one application so selecting Resource
heaps by application will not work.
A Resource indexing approach is a possibility I am considering. It will only work if all routines that use
Resource Handles to access Resource Data directly can be patched.
Note: all posts between Oct 19 2007 and Nov 15 2007 did not refer to resources.QUOTE (modicr @ Nov 16 2007, 03:29 AM)
Here is a nice article regarding Windows resources:
http://apptools.com/rants/resources.php QUOTE
Under Windows 3.x, each of these two areas of memory was limited to 64K. All running applications shared that 64K for User resources and 64K for GDI. Needless to say, that created a huge bottleneck.
With the introduction of Windows 95 and continuing through Windows 98 and Windows Me, that 64K was increased dramatically and each of the two areas was further subdivided as follows:
- The 16-bit User heap (64K).
- The 32-bit User window heap (2MB).
- The 32-bit User menu heap (2MB).
- The 16-bit GDI heap (64K).
- The 32-bit GDI heap (2MB).
However, each one of these five memory sections is still fixed in size due to the Windows 9x/Me architecture, and cannot be increased, regardless of the amount of physical memory (RAM) installed on the machine. Modern applications demand more and more of the system. The more controls an application creates and the more files it opens, the more stress is placed on the operating system
Roman
QUOTE (oscardog @ Nov 17 2007, 06:00 AM)
If of any help regarding patching user and gdi to overcome system resource limitations I notice that the GDT (global descriptor table) is used mainly for holding descriptor entries of operating system segments. In which the descriptor fields Base points to the starting location in the 4GB linear address space, D/B segment size bit, when the bit is set the processor assumes a 32bit segment (here perhaps allows the modifying of the 16bit heaps to 32bit) along with LIMIT segment limit (20 bits) which defines the size of the segment dependant upon Granularity bit being set or clear. The descriptor type bit and segment type should hopefully already be set as needed
If the 16 bit heaps are changed to 32 bit and allowed 2mb in seqment size the rest of the global descriptor table would then need its existing entries moved 2mb -64kb to accomadate this. Perhaps rebasing of some files will be required to conform to the new table
QUOTE (dencorso @ Nov 18 2007, 12:52 AM)
Once upon a time, when Windows meant either Win 3.1 or Wfw 3.11, there was Helix Hurricane...
It had a "Heap Expander" that really did manage to expand the system's resources. It comprised two files: a 5.3KB VxD called HEAPX.386, and a 38.1KB NE driver, HEAPX.DRV... Helix got bought by McAfee (NAI, at that point) and never developed a Win 9x version for "Heap Expander", which was incompatible with Win 9x, because of the serious differences in implementation of GDI and USER heaps between Win 3.1 and Win 9x (described some posts above).
Be as it may, perhaps in-depth study of HEAPX.* might lend some interesting ideas on how to overcome the resources problem...