💾 Archived View for cugi.ie › aminet › 1722685015.gmi captured on 2024-09-29 at 01:08:16. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2024-08-18)

-=-=-=-=-=-=-

trace unmatched allocs to find mem leaks

   Author:       thomas.richter at alumni.tu-berlin.de (Thomas Richter)
   Uploader:     thomas richter alumni tu-berlin de (Thomas Richter)
   Type:         dev/debug
   Version:      1.02
   Architecture: m68k-amigaos >= 2.0.4
   Date:         2024-08-03
   Readme:       http://aminet.net/dev/debug/MemLog.readme
   Downloads:    812

http://aminet.net/dev/debug/MemLog.lha

-----------------------------------------------------------------------------

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, as prepared by the author

of the Program, Thomas Richter. Each licensee is addressed as "you".

The Program and the data in the archive are freely distributable

under the restrictions stated below, but are also Copyright (c)

Thomas Richter.

Distribution of the Program, the Archive and the data in the Archive 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) Distributing the Program on a physical data carrier (e.g. CD-ROM,

DVD, USB-Stick, Disk...) provided that:

a) the Archive is reproduced entirely and verbatim on such data carrier,

including especially this licence agreement;

b) the data carrier is made available to the public for a nominal

fee only, i.e. for a fee that covers the costs of the data carrier,

and shipment of the data carrier;

c) a data carrier with the Program installed is made available to the

author for free except for shipment costs, and

d) provided further that all information on said data carrier is

redistributable for non-commercial purposes without charge.

Redistribution of a modified version of the Archive, the Program or the

contents of the Archive is prohibited in any way, by any organization,

regardless whether commercial or non-commercial. Everything 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 THE PROGRAM, THE ARCHIVE

AND ALL DATA OF THIS ARCHIVE FROM YOUR STORAGE SYSTEM. YOU ACCEPT THIS

LICENCE BY USING OR REDISTRIBUTING THE PROGRAM.

Thomas Richter

-----------------------------------------------------------------------------

So long,

Thomas (July 2024)

Contents of dev/debug/MemLog.lha

PERMISSION  UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP     NAME
---------- ----------- ------- ------- ------ ---------- ------------ ----------
[unknown]                 1458    2316  63.0% -lh5- e2a2 Jul 28 16:49 MemLog
[unknown]                 2966    7004  42.3% -lh5- caed Jul 26 17:47 MemLog.readme
---------- ----------- ------- ------- ------ ---------- ------------ ----------
 Total         2 files    4424    9320  47.5%            Aug  3 11:36

Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminet aminet net>