TweakHomePC

Dual-booting all versions of Windows and Linux

   Dual-Boot    |    Win 8    |    Win 7    |    Vista    |    Win XP/2K/NT    |    Win9x/Me    |    How to    |    Legacy 9x Tweaks    |    SiteMap   


 

Here: Home > Legacy 9x Tweaks > Memory Tweaks >


RESOURCES

Resource error messages, Out of memory, & Crashes

Memory leaks are usually due to crashed programs that can not release RAM, or to poorly designed programs that do not release their allocation of RAM when they are closed.

Resource leaks occur when poorly coded programs are closed and fail to release resources from a very special, and specific, area within main memory.

Resource leaks and memory leaks should not be confused with one another. Ensuring adequate free memory will help with memory leaks or memory shortage, but will do nothing for resource leaks.

SYSTEM RESOURCES

Resources are not Memory. They are a small, limited, part OF memory!

Manage 'total' Windows 9x memory for best performance

There is much confusion about resources, and especially 'System Resources'.
So let's start with a few simple statements that are easy to remember and clarify the situation.

• A tiny area of memory is permanently set aside by Windows 9x to hold information data.
• This data is needed for access to items that are in use.
• The area has a FIXED size irrespective of how much RAM you have. That's the problem!
• This is not connected with the 640K DOS limitation (a leftover from DOS).
• This is a Windows limitation (a leftover from the original MS Windows).
• System Resources area is split into different types, each fully independent.
• The three 32-bit types are USER, GDI, and KERNEL Resources.
• There are two areas allocated to 16-bit programs - and they can be a problem!
• These small areas in memory are fixed in size and are never used for anything else.
• Being short of resources does not mean you are short of main memory;
• adding more memory would result in exactly the % of Resource - if nothing else was changed.
• Being short of 'X' Resources means you are using too much of that allocated area.

• When Windows tells you 'System Resources:  11% free', it is saying that 11% of the allocated area is currently unused . . . . . Windows is not commenting on the percentage of total, or usable, free memory you have! (you may have oodles . . . or little!).


OUT OF 'MEMORY'

If you are running out of System Resources:
Windows 9x is normally perfectly happy using resources up to about 85%. It's when the free resources fall below about 10-15% that problems may be encountered.
• You get error messages like "Out of memory", or "System Resources are running low" "Not enough memory to display completely"
- or -
• You get unusual events such as garbled/blank windows, keyboard/mouse/other problems
- or -
• Application(s) lockup, or your system crashes.

You need to immediately close some program(s), or to reboot, but read 'What to do' (below)
You need to identify/cure/remove a possible resource-leaking program, or use less in future
You can view the current status: Device Manager / Performance
and use Resource Meter (Windows/rsrcmtr.exe) to view its details

If you are running out of memory for running programs:
• Paging to/from the Hard Disk kicks in, before you run out! (Virtual Memory is used)
• If you do run out of both (unlikely), then you can first expect some warning prior to crashing.
  You may need to urgently save current files - if you can! (try the Windows key if possible)

For ANY progran to run, it needs some free resources AND some free memory.
Paging to the swapfile (Virtual Memory) can cope with a lack of free memory (slowly!).
Nothing copes with a lack of resources - except releasing some.


RESOURCE LEAKS

Some software leak Resources

When an program is shut down, or part of it is no longer needed, its resources are released and are now available for use by other programs. That's the theory!

In practice only very well coded programs behave in this manner. Even these sometimes keep a little due to retention of some 'shared-type' facilities which might be required again soon (this little bit is not harmful and is likely to be beneficial).

A poorly coded program may fail to release some resources. Then re-open and re-close it or another poor one, and the same thing happens. Eventually there's not enough available resource space to continue working, and you get an 'out of memory' or a 'resource' error message or a crash.

Programs used in the original Win95 had large problems in this area and crashes were not uncommon due to a lack of resources.

Most application/programs are now improved. Also Win98+ is better at cleaning up after guilty programs and can recover some, but only some, falsely claimed resources. A large leaky application, or many small ones, can still cause substantial problems.

Stating the obvious:
Leaks from Microsoft applications running on a Win9x system are EXTREMELY unlikely!


WHAT YOU CAN DO

Ensure good Resources and prevent Crashes

A problem in one area of memory can have a cascading effect throughout all of memory. So the best approach is management of total Windows memory. Windows performs best when it has plenty of free memory. A Resource warning should not appear until its below 10% - but keep a reserve. Most problems probably occur due to 16-bit programs whose resource management is different. 32-bit programs usually(!) release most, but not entirely all, resources when they are closed.

1. Dump 'leaky' software if at all possible, or get an update for it
2. Avoid/Close all 16-bit applications (Windows 3.x). Win95/98+ treats all of these as a single block and no allocated resources are released until all the 16-bit programs are closed.
3. Minimize the number of programs you use at any one time
4. Avoid most/all Resource-demanding items: Dump Startup, Scheduled, and Automated items that you do not really need. Beware of "Active Desktop View As Web Page", sound effect schemes, animated mouse cursors and desktop icons, fancy screen savers, many Multimedia applications, system monitoring utilities such as Norton SystemWorks
5. Align your larger applications (if you use any large ones!) with Windows' Walign
6. Manage Virtual Memory yourself i.e. your Swap File usage (read Virtual Memory)
7. Optimize Vcache for your personal usage with CacheMan, free, 136KB (read Vcache)
    or preferable use Windows Magazine's free WMalign (read Walign)
    [ DO NOT USE EITHER if you have any element of MS Office 97 or higher installed ]
8. Recover 'lost' memory by running a memory optimizer like MemMax (476KB, free, home page) before gaming, or after a program crash, to freeup some memory and avoid a restart!


FINDING RESOURCE-LEAKING PROGRAMS

Microsoft says:

" 1. Restart your computer, and do not start any programs.

2. Right-click My Computer, click Properties, and then click the Performance tab. Note the percentage number next to System Resources. This is the amount of free system resources before you run any programs.

3. Start one of your programs, use it as you would normally for 15 or more minutes, and then quit the program.

4. Go back to the Performance tab. Note the percentage number next to System Resources, and compare it to the number you noted in step 2. If your system resources are substantially less than they were previously, your program may be creating a memory leak. To resolve this issue, contact the manufacturer of your program to inquire about the availability of a fix for this issue. To work around this issue, restart your computer after you quit the program. "

Note I: A large drop is always suggestive of a leak. You can usually ignore a drop of just a few percent (some resources may have been intentionally left in the User or GDI areas to speed the next use of a shared component)

Note II: Running a memory optimizer like MemMax (476KB, free, home page), will freeup xMB of general RAM for use by another program, but WILL NOT freeup resources for you.


RESOURCE METER

More serious investigation with Resource Meter

This little, but useful, utility allows you to keep track of current resources.

It shows just three bars. At the top is System Resources and this will always be either User or GDI resources whichever is currently lowest. This is the resources you see in Device Manager / Performance i.e. always the lowest resource at that time.

The second bar shows User Resources and the third shows GDI Resources.

Viewing resources over a period can be very instructive about limitations of you system and programs. In particular it may help identify the source of a resource leak. You can make a Shortcut to it (windows/rsrcmtr.exe) and drag that onto the Taskbar for viewing anytime.

While you might want to aim for resources as high as possibly (and perhaps you should!), you may find that a lower level can achieve equal performance. There appears to be some discrepancy between systems that may well be due to different total memory management control (including items such as Vcache and Virtual Memory).

If already installed, it is in Start / Programs / Accessories / System Tools
If not, install it via Control Panel / Control Panel / Add/Remove Programs / Windows Setup / System Tools / Details (have the Win installation CD to hand)


UTILITIES TO CONTROL LEAKS

Don't expect much from utilities

Memory Optimizers
When it come to fixing resources leaks they do not work and can not work. One of these may in fact make the resources situation a little worse because it is an extra resource itself! There is little, or no, room for disagreement on this. Claims that one of these increase resources by x% is a total, and perhaps intentional, misuse of the term resource - it should, if anything, be referring to free/usable memory.

In the main, these utilities work by pretending to be very large. This forces Windows to remove unused DLLs and push plenty of data (the least necessary) into slow Virtual Memory. The utility then 'shrinks' to its normal size leaving plenty of free memory for running another program.

ANY use of the very slow Virtual Memory will slow any system. Understand? However they are useful for single-time use when you want to flush unneeded items from memory (not resources) into VM prior to gaming, or to reclaim memory still taken by a crashed program - avoids a restart. THPC frequently uses MemMax (423BK, freeware, Memory Monitor/Optimizer + Vcache tuner) - it works just fine in releasing RAM, but not resources of course!


WHAT ARE RESOURCES?

Resources contain location information on every item in use

Resources can be anything depending on your current activity. They hold location identifiers so think of them as addresses to every item used in RAM, and are VITAL to Windows operations.

Everything used in memory is composed of very many individual functional items. Each of these items must be locatable to be used and are identified by their position in memory (addresses).

An address is the location of the first byte of an item in memory. Therefore the next item will start some distance further on. For example window A might start at byte number 65,536, window B start at 69,634, graphics A start at 98,320, and so on (though those decimal numbers should be stated in Hexadecimal like you have seen in "XXX Error xxx at F0E3C9CC" indicating an error in the item starting at that address in memory).

When you start an application it uses many thousands of resources because the application sets up many items in memory each one requiring its own memory address. You now open the Help window; more resources. The Help window has graphics; more resources. You open a file; more resources. You close the file and Help window; that releases some resources. You close the application; that releases plenty of resources (but mooore on that later!).

As stated previously only a small, and unalterable, amount of RAM is allocated to Resources; adding more RAM does not increase the availability of Resources.


RESOURCE TABLE

What did Microsoft do about Resources?

Accessing these addresses via the Resources area is integral to Windows and can not be changed. So why didn't Microsoft just increase the area size when Win95 was being developed?

This would require changing the Resource area from 16-bit to 32-bit. That would be moving from 2 byte addressing (and just 65,536 possible combinations) to 4 byte addressing (and billions of combinations). MS didn't do so because none of the existing 16-bit software would have worked any longer and all would have to be rewritten! A 64-bit OS is under development and perhaps(!) it will resolve this important issue (CPUs are now very fast, so maybe it will work through emulation as that would allow for backward compatibility).

Instead, Microsoft created a special Resource Table to hold the 4 byte addresses and this Table was given three separate parts, one each for User, GDI, and Kernel (basically separate tables). The resource area itself now holds a numeral index (2 byte) pointing to the Resource Table (4 byte). Also, vitally and by default, a User call can access a GDI or Kernel table (and visa-versa).

For example if a resource holds a #244 that would mean 'the address you want is the 244th item in the Resource Table'. A 244th item may be present in all three sections of the Resource Table. However only ONE will be acceptable because the others are of a different type [much of this explanation is based on a Forum contribution by a Kickaha Ota / no link available / Thanks].
This method greatly improved matters but 4 byte resources would have been the cure. Lack of resources is still a problem some time or other for most users, and more often for others.


USER & GDI RESOURCES

There are three totally independent resource areas

USERarea: This contains information about all the applications currently running, including windows, dialog boxes, the controls in dialog boxes, and so on. Its for every DLL (Display Link Library) your applications use. The more applications you use then the more the User area become filled.

GDIarea: The GDI contains information about things used to create graphics (Graphics Device Interface). It includes items such as images, fonts, pens, brushes, regions, palettes, and the like. So the GDI area fills up as you have more graphical objects on the screen.

Applications can use many thousands resources. Remember both resource areas are of a fixed size regardless of how much RAM you have -- and that's the problem. If you run too many things, including graphics, you can deplete the User or GDI area. When that happens, you get resource error messages, or unusually behavior, or you crash.

However the allocation is actually quite enough in the vast majority of cases. Yet some users do encounter problems with the User and/or GDI areas and this is due to leaking software.

KERNEL area: This contains information about routines that manage the computer's hardware, and is not an issue in this discussion.

[top of page]

Please remember that you alone are responsible for the consequences of any changes you make to your computer hardware or software.

Copyright © LarryM 1998-2015 thpc@mail.com