home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 49
/
Amiga_Dream_49.iso
/
amiga
/
workbench
/
commodoties
/
poolmem.readme
< prev
next >
Wrap
Text File
|
1998-02-11
|
11KB
|
292 lines
Short: Memory defragmentizer/AllocP superset
Author: thor@math.tu-berlin.de (Thomas Richter)
Uploader: thor@math.tu-berlin.de (Thomas Richter)
Version: 1.21
Type: util/sys
Requires: OS 2.0 at least
______________________________________________________________________________
NEWS FLASH: Found serious bug in XiPaint that caused crashes with PoolMem,
check below for details.
______________________________________________________________________________
1.21:
PoolMem flushes now the memory as it should if called by AllocMem(-1,..).
Except that, nothing changed.
1.20:
Added the CHIPFWD command. Works like INSTALL but allocates chip mem in
standard (forwards) mode instead of backwards mode. Might solve strange
compatibility problems. Added more sanity checks, included PatchReplyMsg
to create warnings for broken programs.
1.19.1:
Changed the name of the DefragMeter to FragMeter because that makes more
sense. Added a chunk count to this program. PoolMem itself unchanged.
______________________________________________________________________________
About PoolMem:
If you run a lot of programs without resetting the system, you'll
usually find that the main memory of the computer is getting "messed up",
split in lots of tiny memory "snippets" that are more or less useless due to
their tinyness. It may happen that you can't start an application even though
enough memory is available - because this memory is too fragmentated to
be of any use.
That's the point where PoolMem tries to help you: It manages the main memory
in a way such that it can't get fragmentated too easely. It replaces also
the function of AllocP, which is therefore obsolete.
______________________________________________________________________________
Installation and Usage:
Copy the PoolMem program in this archive to the C: directory of your
system partition. Add the following line to your startup-sequence:
PoolMem >NIL:
You might also want to install "PatchRAM" which is included in this archive,
too. It modifies the system RAM disk in a way that avoids memory
fragmentation, too. Another bonus is that the RAM disk will show its true
size from now on, i.e. it won't be no longer 100% full.
To remove PoolMem later on, open a shell window and enter
PoolMem remove
Other command line options:
PoolMem install Identical to the standard installation
PoolMem ChipFwd Doesn't allocate chip memory backwards. Might solve
compatibility problems, but isn't perfect for the
fragmentation.
______________________________________________________________________________
Compatibility:
There are a couple of relatively deep patches of the memory system
that shouldn't be run together with PoolMem:
- SetPatch: The 68040 library which is loaded by this program seems
to allocate the MMU tables in a strange way incompatible
to the scratch list of PoolMem. Easy solution: run
PoolMem after SetPatch.
- MemSniff: (The THOR MungWall replacement) Patches deep into the memory
allocation routines, too deep for PoolMem.
I guess that's all for now...
Buggy programs that crash with PoolMem installed:
- XiPaint 3.2 (or XMouse, to be precise):
The message handling of the mouse driver is broken. After a long debug
session deep into the night, I found that the crashes were created by the
mouse driver XMouse. It replies messages that are no longer valid and have
been FreeMem()'d before. THIS IS DEFINITELY ILLEGAL AND NOT A POOLMEM PROBLEM.
To help you checking other programs as well, I included a tiny patch
"PatchReplyMsg". You shouldn't install it permanently, though, because it
slows down the message system. If, after installation of this patch, a
program crashes with guru 0x01000001f, THEN THIS PROGRAM HAS THE SAME BUG
AS XIPAINT and replies illegal messages. This will crash your system anyways,
with or without PoolMem. Please sent a bug report to the author, or remove
these programs. As I said, THIS IS NO POOLMEM problem.
The guru 0x01000013 is rather typical for these programs - they invalidate
the internal scratch list of PoolMem.
______________________________________________________________________________
Theory of operation:
PoolMem splits all available memory in two blocks: One block is used
for the small memory snippets (always taken from there), the other block is used
for huge allocations. This partition of the main memory is dynamic, i.e. each
sub-pool can grow and shrink, depending on the memory requirements.
The "public/ANY" memory gets a special treatment. PoolMem manages a "scratch"
list for tiny memory blocks taken from there. Instead of taking these tiny
memory blocks always from the main memory, they are taken from this (global,
though) memory pool and put back into this pool if they get freed. A special
garbage collection task cleans this "scratch list" from time to time, or if
it overruns. The main profit is taken from the layers.library, which uses to
allocate tons of tiny snippets and is therefore the main cause for memory
fragmentation.
The "chip" memory is treated a bit different. It's also split into two
distinct memory pools (small and large), but memory from the large pool
is allocated in reverse direction - unless you run PoolMem with the
ChipFwd keyword, of course; this happens for two reasons: First, it
helps to keep the memory defragmentated, so the big pool can't run that
easely into the small pool. Second, it works around a hardware bug of my
computer (the refresh of the high end chip memory in my computer seems to
be a bit buggy - some bits tend to flip if they aren't frequently accessed,
for example by the DMA processor as display memory.)
For details about the PatchRAM program, check its readme file. As I said, if
you run PoolMem, you're supposed to run PatchRAM as well. It helps PoolMem
a lot in its job!
_________________________________________________________________________________
Additional programs:
The PoolMem program is still in a somewhat experimental stage, even though
it's running stable for my system for more than two years now - I won't
expect any serious bugs, though.
However, if you like to see how PoolMem works and if it has any effects, I
provided several extra programs:
ShowMem: Shows the allocated/free memory in a graphical over-
view. For details, check the ShowMem readme and its
guide. (Available separately as well)
PatchRAM: Modifies and improves the RAM disk. Shows the correct
size of the RAM drive, improves the memory allocation
sheme of it as well. Should be run together with
PoolMem. For details, check the guide of PatchRAM.
FragMeter: Calculates the fragmentation of your memory. The
output is given separately for each memory type.
A 100% defragmentation indicates that all the free
memory is messed up in tiny blocks of eight bytes
each (maximal defragmentation).
A Shannon-type approach is used to measure the
defragmentation (the algorithm calculates the
Shannon entropy of the memory blocks with the formula
sum += log(chunk->mc_Bytes/total)
If you've a better approach for measuring the
fragmentation, lemme now. This here seems at least
reasonable for me as a theoretical physicst... ;-)
This program can be used to test the efficency of
PoolMem. My measurements indicate that the entropy is
about halved.
MemoryMess: A program that tries to fragmentate the main memory
as worse as possible by allocating and freeing memory
in random order. Can be used together with the
FragMeter to measure the efficiency of PoolMem or
with ShowMem to watch PoolMem at its job. Can be
canceled safely with ^C (Control-C). Does nothing
useful except that.
PatchReplyMsg: Useful to find buggy programs, like XiPaint.
PatchReplyMsg will create a guru 0x0100001f if a
program attempts to reply an already de-allocated
message. Don't install it permanently, but use it
to find the reason for crashes.
If you've ideas how to improve PoolMem, lemme know....
______________________________________________________________________________
Guru meditations thrown by PoolMem:
0x01000013 Scratch entry illegal.
Some program invalidated the internal memory scratch
list of PoolMem - by overwriting memory that has been
deallocated before. An (in)famous example is XiPaint.
Run "PatchReplyMsg" and a debugger (e.g. COP) to check
for details.
0x0100000f MemHeader not found.
Some program attempted to free a non-existing block
of memory. PoolMem (or exec) wasn't able to locate
the MemHeader.
0x01000011 MemHeader insane.
PoolMem found a MemHeader whose number of available
bytes does not match the size of its pool.
0x01000012 Invalid DeleteHeader (internal).
Someone tried to deallocate the "large" memory pool.
This is an internal guru, shouldn't happen.
______________________________________________________________________________
The THOR-Software Licence
This License applies to the computer programs known as "PoolMem", "ShowMem",
"FragMeter", "MemoryMess" and "ShowMem".
The "Program", below, refers to such program.
The programs and files in this distribution are freely distributable
under the restrictions stated below, but are also Copyright (c)
Thomas Richter.
Distribution of the Program by a commercial organization without written
permission from the author to any third party is prohibited if any payment
is made in connection with such distribution, whether directly
(as in payment for a copy of the Program) or indirectly (as in payment
for some service related to the Program, or payment for some product
or service that includes a copy of the Program "without charge";
these are only examples, and not an exhaustive enumeration of prohibited
activities). However, the following methods of distribution involving
payment shall not in and of themselves be a violation of this restriction:
(i) Posting the Program on a public access information storage and
retrieval service for which a fee is received for retrieving information
(such as an on-line service), provided that the fee is not
content-dependent (i.e., the fee would be the same for retrieving the same
volume of information consisting of random data).
(ii) Distributing the Program on a CD-ROM, provided that the files
containing the Program are reproduced entirely and verbatim on such
CD-ROM, and provided further that all information on such CD-ROM be
redistributable for non-commercial purposes without charge.
Everything in this distribution must be kept together, in original
and unmodified form.
Limitations.
THE PROGRAM IS PROVIDED TO YOU "AS IS," WITHOUT WARRANTY. THERE IS NO
WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE
RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
SERVICING, REPAIR OR CORRECTION.
IF YOU DO NOT ACCEPT THIS LICENCE, YOU MUST DELETE ALL FILES CONTAINED IN
THIS ARCHIVE.
______________________________________________________________________________
Have fun,
Thomas January 1998