trace unmatched allocs to find mem leaks
- Size
- 4.4K (4,498 bytes)
- Added
- 2026-11-20 02:43
- Downloads
- 2
- Long Description
- ----------------------------------------------------------------------------- New in V1.00: This is the first Aminet release New in V1.01: MemLog also records now the total amount of memory required by an application, and prints out how much memory was not released during its course. Also, MemLog now prints the currently allocated memory on CTRL-F. If SegTracker is installed, MemLog now defers the unloading of segments until either aborted or CTRL-F is pressed to allow SegTracker finding segment information of recently run programs. New in V1.02: If SegTracker V47 or newer is present, MemLog will also attempt to print the function, line number and file within which the memory was allocated. MemLog no longer conflicts with SaferPatches, previous releases could have created a recoverable alert when terminating. ----------------------------------------------------------------------------- What is the purpose of this utility: This utility helps to identify memory leaks in programs and the AmigaOs operating system. To this end, it logs all allocations made by a specific task or a specific ROM module, and upon exit, prints where the allocations have been made. If the SegTracker utility is installed as well, this allows the identification of the hunk and offset from where memory was allocated. This may then be used to find, within the source, the origin of the allocation, hopefully allowing to hunt down why the allocated memory was not released. Note that AmigaOs may pass memory from one task to another, i.e. this utility may report false positives of memory that is allocated by the supervised task, but is to be released by some other mechanism outside the original task, and that the Os also pools memory itself in some of its libraries - e.g. graphics and layers pool some of their structures. ----------------------------------------------------------------------------- Usage: Ideally, this program should be used together with SegTracker, and the "Avail" program from the system. To start logging, first install SegTracker, then run 1.SYS:> Avail Flush from the shell to release temporary memory. Next, run this utility. 1.SYS:> MemLog TASKNAME myprogram This will record all allocations made by a program "myprogram". The program name is either the name of the task, or the name of a shell program run as a shell process. Next, run in a second shell, or from the workbench, the program to debug: 2.SYS:> myprogram Use "myprogram" now as you would always do, e.g. click on its GUI, enter data, etc... then stop it. After quitting the program, flush temporary memory again: 2.SYS:> Avail Flush Close the second shell window, go now back to the first shell window, and abort "MemLog" with ^C (i.e. press Control + C). At this point, MemLog will print, on the shell, the memory segments that have not been released yet, but that have been allocated by your program, along with a stack traceback where the call came from, along with SegTracker information on the hunk and offset where the specific function call is within the program. Alternatively, "MemLog" may also be used to observe allocations from a specific ROM module only, by running it as such: 1.SYS:> MemLog MODULE dos.library This will log all allocations that come, one way or another, from the dos.library and functions within the dos.library, or, to trace allocations coming from a task, within a specific ROM module: 1.SYS:> MemLog TASK myprogram MODULE dos.library While the program to be observed is running, you may press ^F (Control + F) to get a print-out of the currently allocated memory blocks. ------------------------------------------------------------------------------ The THOR-Software Licence (v3, January 2nd 2021) This License applies to the computer programs known as the "MemLog" and its sources. The "Program", below, refers to such program. The "Archive" refers to the package of distribution,