Short: Trace the origin of memory flushes. Author: andrew.ab2000@bigfoot.com (Andrew Bell) Uploader: andrew ab2000 bigfoot com (Andrew Bell) Type: dev/debug Requires: AmigaOS 3.0 or better. Architecture: m68k-amigaos Visit my homepage at: http://www2.prestel.co.uk/ab2000 ------------------------------ Introduction ------------------------------ Vivid is a simple tool (much like Enforcer) that allows the user to monitor the origin of memory flushes. This tool is really for the advanced Amiga user, but can be used by anyone who is curious about what task or process is flushing the memory. It does this by installing a dummy low memory handler onto the system. So every time a memory allocation fails (i.e. AllocMem() or AllocVec() returns a NULL), the system will attempt to flush as much memory as possible by traversing the list of installed low memory handlers, calling each of them. When the dummy handler installed by Vivid is called, it will collect as much information about the task that triggered the flush, then print this information to the Shell window. Typically, a program flushes the memory by calling AllocMem(~0,MEMF_ANY) or similar. The full C source code has been included for the curious. ------------------------------ DISCLAIMER ------------------------------ FOR THE PURPOSE OF THIS DISCLAIMER, "SOFTWARE" REFERS TO ALL THE FILES PROVIDED IN THE ORIGINAL ARCHIVE DISTRIBUTED BY THE AUTHOR. THIS DISCLAIMER APPLIES TO ALL WHO USE THIS SOFTWARE. THE AUTHOR HAS DONE HIS BEST TO ENSURE THAT THIS SOFTWARE IS FREE FROM DEFECTS, ALTHOUGH THE AUTHOR CANNOT GUARANTEE THIS. THE AUTHOR HEREBY REJECTS ANY LIABILITY OR RESPONSIBILITY FOR THESE OR OTHER CONSEQUENCES FROM THE USE OF THIS SOFTWARE. THIS INCLUDES, BUT IS NOT LIMITED TO, DAMAGE TO YOUR EQUIPMENT, TO YOUR DATA, TO OTHER COMPUTERS / DEVICES YOUR COMPUTER IS CONNECTED TO, PERSONNAL INJURY, FINANCIAL LOSS OR OTHER EFFECTS. THIS SOFTWARE IS PROVIDED AS-IS. THIS MEANS THE AUTHOR CANNOT GUARANTEE THAT IT IS FIT FOR ANY SPECIFIC PURPOSE AND THE AUTHOR DOES NOT GUARANTEE BUG FIXES, UPDATES OR HELP DURING ERROR RECOVERY. (After all, you did get it for free!) ------------------------------ Distribution ------------------------------ This software is emailware, which means that this archive can be freely distributed provided it's components are not altered or deleted by anyone other than the copyright holder (Andrew Bell). It also means if you use the software often you should send the author an email with some feedback. Distribution via diskette, CD-ROM or other electronic medium is allowed provided that the archive is distributed in it's original state, and that the end user is not charged for this software (although you are allowed to charge them for the medium it is supplied on, this cost must not exceed £5 UK pounds). If you are going to distribute this software via a magazine cover mounted medium, I recommend that you contact the author for the latest version of the software. The address is provided below. ------------------------------ Usage ------------------------------ To start Vivid, run it from a Shell window. That's all you need to do, no complicated Shell paramteres are required. The next time something attempts to flush the memory, the following information will be dumped to the Shell window: ·The number and date of the memory flush. ·The task pointer and name of the task that triggered the flush. ·The size of memory requested (Taken from the MemHandlerData structure). ·The flags for the requested memory (also from the MemHandlerData structure). ·The flags for the MemHandlerData structure itself. Here is an an example of the output: (START OF EXAMPLE) Vivid 1.0 (20.10.99), Copyright © 1999 Andrew Bell. All rights reserved. Vivid has been installed. Press `Control + C' to break out. A memory flush has been detected (no. 001) : Wednesday 20-Oct-99 01:23:58 Low mem handler was triggered by task: 0x785C50B8 (FlushTest) memh_RequestSize = 0xFFFFFFFF memh_RequestFlags = 0x00010002 (MEMF_CHIP, MEMF_CLEAR) memh_Flags = 0x00000000 (No flags given) (END OF EXAMPLE) The last three line that start with memh_* will only be of use to programmers. It show the information that was passed via the MemHandlerData parameter when the dummy handler was called. ------------------------------ Options ------------------------------ PRIORITY/N This option allows you to specify the priority of the dummy memory handler, that is installed by Vivid. If this parameter is not provided, Vivid will default to a priority of 25. REQ/S Tell Vivid to force it's output to a requester instead of using the Shell. Warning, this option is quite annoying. :) ------------------------------ Limitations ------------------------------ Vivid will only be able to catch memory flushes that are triggered via exec.library's low memory handlers. It will not work with tasks that manually traverse the system library list (etc.), calling the Expunge() vector of each one. To be absolutely safe, you should *NOT* keep Vivid running in the back- ground *ALL THE TIME*. It's only for debugging purposes. So don't be installing it into your user-startup or startup-sequence, unless you know what you're doing. ------------------------------ Copyright ------------------------------ This program and all related files are Copyright © 1999 Andrew Bell. All rights reserved. This program is EMAILWARE, if you use it often, please send the author an email (my email address is provided below). Feal free to send suggestions or ideas on how I could improve this program. Thanks. ------------------------------ The author ------------------------------ My name is Andrew Bell, and I can be contacted via electronic mail at andrew.ab2000@bigfoot.com. You can also visit my webpage at: http://www2.prestel.co.uk/ab2000 for the latest updates of this program and to see my other work. Enjoy! :) Andrew.