Short: Memory defragmentizer/AllocP superset Uploader: thor@math.tu-berlin.de (Thomas Richter) Author: thor@math.tu-berlin.de (Thomas Richter) Type: util/sys Version: 1.19 ______________________________________________________________________________ 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 defragmentated 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 ______________________________________________________________________________ Compatibility: There are a couple of relatively deep patches of the memory system that shouldn't be run together with PoolMem: - MemSniff: (The THOR MungWall replacement) Patches deep into the memory allocation routines. I guess that's all for now... ______________________________________________________________________________ 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 "scrap" 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 "scrap 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 defragmentation. 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; this happens for two reasons: First, it helps to keep the memory unfragmentated, 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. DefragMeter: Calculates the defragmentation 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 defragmentation, 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 DefragMeter to measure the efficiency of PoolMem or with ShowMem to watch PoolMem at its job. Can be canceled safely with ^C (Control-C). If you've ideas how to improve PoolMem, lemme know.... ______________________________________________________________________________ The THOR-Software Licence This License applies to the computer programs known as "PoolMem", "ShowMem", "DefragMeter", "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 November 1997