home *** CD-ROM | disk | FTP | other *** search
/ Dream 49 / Amiga_Dream_49.iso / amiga / workbench / commodoties / poolmem.readme < prev    next >
Text File  |  1998-02-11  |  11KB  |  292 lines

  1. Short:    Memory defragmentizer/AllocP superset
  2. Author:   thor@math.tu-berlin.de (Thomas Richter)
  3. Uploader: thor@math.tu-berlin.de (Thomas Richter)
  4. Version:  1.21
  5. Type:     util/sys
  6. Requires: OS 2.0 at least
  7.  
  8. ______________________________________________________________________________
  9.  
  10. NEWS FLASH: Found serious bug in XiPaint that caused crashes with PoolMem,
  11. check below for details.
  12. ______________________________________________________________________________
  13.  
  14. 1.21:
  15.  
  16. PoolMem flushes now the memory as it should if called by AllocMem(-1,..).
  17. Except that, nothing changed.
  18.  
  19. 1.20:
  20.  
  21. Added the CHIPFWD command. Works like INSTALL but allocates chip mem in
  22. standard (forwards) mode instead of backwards mode. Might solve strange
  23. compatibility problems. Added more sanity checks, included PatchReplyMsg
  24. to create warnings for broken programs.
  25.  
  26. 1.19.1:
  27.  
  28. Changed the name of the DefragMeter to FragMeter because that makes more
  29. sense. Added a chunk count to this program. PoolMem itself unchanged.
  30. ______________________________________________________________________________
  31.  
  32. About PoolMem:
  33.     
  34.     If you run a lot of programs without resetting the system, you'll
  35. usually find that the main memory of the computer is getting "messed up",
  36. split in lots of tiny memory "snippets" that are more or less useless due to
  37. their tinyness. It may happen that you can't start an application even though
  38. enough memory is available - because this memory is too fragmentated to
  39. be of any use.
  40.  
  41. That's the point where PoolMem tries to help you: It manages the main memory
  42. in a way such that it can't get fragmentated too easely. It replaces also
  43. the function of AllocP, which is therefore obsolete.
  44.  
  45. ______________________________________________________________________________
  46.  
  47. Installation and Usage:
  48.  
  49.     Copy the PoolMem program in this archive to the C: directory of your
  50. system partition. Add the following line to your startup-sequence:
  51.  
  52. PoolMem >NIL:
  53.  
  54.  
  55. You might also want to install "PatchRAM" which is included in this archive,
  56. too. It modifies the system RAM disk in a way that avoids memory 
  57. fragmentation, too. Another bonus is that the RAM disk will show its true
  58. size from now on, i.e. it won't be no longer 100% full.
  59.  
  60.  
  61. To remove PoolMem later on, open a shell window and enter
  62.  
  63. PoolMem remove
  64.  
  65.  
  66. Other command line options:
  67.  
  68. PoolMem install        Identical to the standard installation
  69.  
  70. PoolMem    ChipFwd        Doesn't allocate chip memory backwards. Might solve
  71.             compatibility problems, but isn't perfect for the
  72.             fragmentation.
  73. ______________________________________________________________________________
  74.  
  75. Compatibility:
  76.  
  77.     There are a couple of relatively deep patches of the memory system
  78. that shouldn't be run together with PoolMem:
  79.  
  80. - SetPatch:    The 68040 library which is loaded by this program seems
  81.         to allocate the MMU tables in a strange way incompatible
  82.         to the scratch list of PoolMem. Easy solution: run
  83.         PoolMem after SetPatch.
  84. - MemSniff:    (The THOR MungWall replacement)    Patches deep into the memory
  85.         allocation routines, too deep for PoolMem.
  86.  
  87. I guess that's all for now...
  88.  
  89.  
  90. Buggy programs that crash with PoolMem installed:
  91.  
  92. - XiPaint 3.2 (or XMouse, to be precise):
  93.  
  94. The message handling of the mouse driver is broken. After a long debug 
  95. session deep into the night, I found that the crashes were created by the
  96. mouse driver XMouse. It replies messages that are no longer valid and have
  97. been FreeMem()'d before. THIS IS DEFINITELY ILLEGAL AND NOT A POOLMEM PROBLEM.
  98.  
  99. To help you checking other programs as well, I included a tiny patch
  100. "PatchReplyMsg". You shouldn't install it permanently, though, because it
  101. slows down the message system. If, after installation of this patch, a 
  102. program crashes with guru 0x01000001f, THEN THIS PROGRAM HAS THE SAME BUG
  103. AS XIPAINT and replies illegal messages. This will crash your system anyways,
  104. with or without PoolMem. Please sent a bug report to the author, or remove
  105. these programs. As I said, THIS IS NO POOLMEM problem.
  106.  
  107.  
  108. The guru 0x01000013 is rather typical for these programs - they invalidate
  109. the internal scratch list of PoolMem.
  110.  
  111. ______________________________________________________________________________
  112.  
  113. Theory of operation:
  114.  
  115.     PoolMem splits all available memory in two blocks: One block is used 
  116. for the small memory snippets (always taken from there), the other block is used
  117. for huge allocations. This partition of the main memory is dynamic, i.e. each
  118. sub-pool can grow and shrink, depending on the memory requirements.
  119.  
  120. The "public/ANY" memory gets a special treatment. PoolMem manages a "scratch"
  121. list for tiny memory blocks taken from there. Instead of taking these tiny
  122. memory blocks always from the main memory, they are taken from this (global,
  123. though) memory pool and put back into this pool if they get freed. A special
  124. garbage collection task cleans this "scratch list" from time to time, or if
  125. it overruns. The main profit is taken from the layers.library, which uses to
  126. allocate tons of tiny snippets and is therefore the main cause for memory
  127. fragmentation.
  128.  
  129. The "chip" memory is treated a bit different. It's also split into two 
  130. distinct memory pools (small and large), but memory from the large pool
  131. is allocated in reverse direction - unless you run PoolMem with the
  132. ChipFwd keyword, of course; this happens for two reasons: First, it
  133. helps to keep the memory defragmentated, so the big pool can't run that
  134. easely into the small pool. Second, it works around a hardware bug of my
  135. computer (the refresh of the high end chip memory in my computer seems to
  136. be a bit buggy - some bits tend to flip if they aren't frequently accessed,
  137. for example by the DMA processor as display memory.)
  138.  
  139. For details about the PatchRAM program, check its readme file. As I said, if
  140. you run PoolMem, you're supposed to run PatchRAM as well. It helps PoolMem
  141. a lot in its job!
  142.  
  143. _________________________________________________________________________________
  144.  
  145. Additional programs:
  146.  
  147. The PoolMem program is still in a somewhat experimental stage, even though
  148. it's running stable for my system for more than two years now - I won't
  149. expect any serious bugs, though.
  150. However, if you like to see how PoolMem works and if it has any effects, I
  151. provided several extra programs:
  152.  
  153. ShowMem:        Shows the allocated/free memory in a graphical over-
  154.             view. For details, check the ShowMem readme and its
  155.             guide. (Available separately as well)
  156.  
  157. PatchRAM:        Modifies and improves the RAM disk. Shows the correct
  158.             size of the RAM drive, improves the memory allocation
  159.             sheme of it as well. Should be run together with
  160.             PoolMem. For details, check the guide of PatchRAM.
  161.  
  162. FragMeter:        Calculates the fragmentation of your memory. The
  163.             output is given separately for each memory type.
  164.             A 100% defragmentation indicates that all the free
  165.             memory is messed up in tiny blocks of eight bytes
  166.             each (maximal defragmentation).
  167.             A Shannon-type approach is used to measure the
  168.             defragmentation (the algorithm calculates the
  169.             Shannon entropy of the memory blocks with the formula
  170.             sum += log(chunk->mc_Bytes/total)
  171.             If you've a better approach for measuring the
  172.             fragmentation, lemme now. This here seems at least
  173.             reasonable for me as a theoretical physicst... ;-)
  174.             
  175.             This program can be used to test the efficency of
  176.             PoolMem. My measurements indicate that the entropy is
  177.             about halved.
  178.  
  179. MemoryMess:        A program that tries to fragmentate the main memory
  180.             as worse as possible by allocating and freeing memory
  181.             in random order. Can be used together with the 
  182.             FragMeter to measure the efficiency of PoolMem or
  183.             with ShowMem to watch PoolMem at its job. Can be
  184.             canceled safely with ^C (Control-C). Does nothing
  185.             useful except that.
  186.  
  187. PatchReplyMsg:        Useful to find buggy programs, like XiPaint.
  188.             PatchReplyMsg will create a guru 0x0100001f if a
  189.             program attempts to reply an already de-allocated
  190.             message. Don't install it permanently, but use it
  191.             to find the reason for crashes.
  192.  
  193.  
  194. If you've ideas how to improve PoolMem, lemme know....
  195.  
  196. ______________________________________________________________________________
  197.  
  198. Guru meditations thrown by PoolMem:
  199.  
  200. 0x01000013        Scratch entry illegal.
  201.  
  202.             Some program invalidated the internal memory scratch
  203.             list of PoolMem - by overwriting memory that has been
  204.             deallocated before. An (in)famous example is XiPaint.
  205.             Run "PatchReplyMsg" and a debugger (e.g. COP) to check
  206.             for details.
  207.  
  208. 0x0100000f        MemHeader not found.
  209.  
  210.             Some program attempted to free a non-existing block
  211.             of memory. PoolMem (or exec) wasn't able to locate
  212.             the MemHeader.
  213.  
  214.  
  215. 0x01000011        MemHeader insane.
  216.  
  217.             PoolMem found a MemHeader whose number of available
  218.             bytes does not match the size of its pool.
  219.  
  220.  
  221. 0x01000012        Invalid DeleteHeader (internal).
  222.  
  223.             Someone tried to deallocate the "large" memory pool.
  224.             This is an internal guru, shouldn't happen. 
  225.  
  226. ______________________________________________________________________________
  227.  
  228.                         The THOR-Software Licence
  229.  
  230.  
  231. This License applies to the computer programs known as "PoolMem", "ShowMem",
  232. "FragMeter", "MemoryMess" and "ShowMem".
  233. The "Program", below, refers to such program.
  234.  
  235.  
  236. The programs and files in this distribution are freely distributable
  237. under the restrictions stated below, but are also Copyright (c)
  238. Thomas Richter.
  239.  
  240.  
  241. Distribution of the Program by a commercial organization without written
  242. permission from the author to any third party is prohibited if any payment
  243. is made in connection with such distribution, whether directly
  244. (as in payment for a copy of the Program) or indirectly (as in payment
  245. for some service related to the Program, or payment for some product
  246. or service that includes a copy of the Program "without charge";
  247. these are only examples, and not an exhaustive enumeration of prohibited
  248. activities). However, the following methods of distribution involving
  249. payment shall not in and of themselves be a violation of this restriction:
  250.  
  251.  
  252. (i) Posting the Program on a public access information storage and
  253. retrieval service for which a fee is received for retrieving information
  254. (such as an on-line service), provided that the fee is not
  255. content-dependent (i.e., the fee would be the same for retrieving the same
  256. volume of information consisting of random data).
  257.  
  258.  
  259.  
  260. (ii) Distributing the Program on a CD-ROM, provided that the files
  261. containing the Program are reproduced entirely and verbatim on such
  262. CD-ROM, and provided further that all information on such CD-ROM be
  263. redistributable for non-commercial purposes without charge.
  264.  
  265.  
  266.  
  267. Everything in this distribution must be kept together, in original
  268. and unmodified form.
  269.  
  270.  
  271.  
  272.  
  273. Limitations.
  274.  
  275. THE PROGRAM IS PROVIDED TO YOU "AS IS," WITHOUT WARRANTY. THERE IS NO
  276. WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
  277. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  278. PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE
  279. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
  280. THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  281. SERVICING, REPAIR OR CORRECTION.
  282.  
  283.  
  284.  
  285. IF YOU DO NOT ACCEPT THIS LICENCE, YOU MUST DELETE ALL FILES CONTAINED IN
  286. THIS ARCHIVE.
  287.  
  288. ______________________________________________________________________________
  289.  
  290. Have fun,
  291.     Thomas        January 1998
  292.