AminetAminet
Search:
84734 packages online
About
Recent
Browse
Search
Upload
Setup
Services

dev/debug/memtrace_os4.lha

Mirror:Random
Showing: m68k-amigaos iconppc-amigaos iconppc-morphos iconi386-aros iconi386-amithlon iconppc-warpup iconppc-powerup icongeneric icon
No screenshot available
Short:Debug memory allocation and freeing
Author:Markus Wolf, AmigaOS 4.0 compile by Spot / Up Rough
Type:dev/debug
Version:1.0
Architecture:ppc-amigaos
Date:2008-11-20
Download:dev/debug/memtrace_os4.lha - View contents
Readme:dev/debug/memtrace_os4.readme
Downloads:883

This port was requested by Raziel, so, enjoy!(?) /spot

Author:  Markus Wolf
Web:     http://www.murkymind.de
Version: 1.0 (20-nov-2006)

The "memtrace" include files provides overview over dynamic memory allocation
and deallocation for C/C++ code.
A C++ compiler is required. It is intended for debugging and should be excluded
(deactivated) for final project compilation.

Files:
"memtrace.h"            : The only file to include into a project (include file
tree)
"memtrace_internal.h"   : "MemTrace" class definition, "MemTrace" configuration
via preprocessor directives, method descriptions
"memtrace_internal.cpp" : "MemTrace" methods, must be compiled as separat object
so a single global ("extern") instance can be used for a whole project



How to use:
-----------
- Edit the preprocessor configuration in "memtrace_internal.h" to your needs.
- Compile "memtrace_internal.cpp" as separate object. It includes the one and
only instance "memtrace" of class "MemTrace".
- Include "memtrace.h" in the project where allocation should be watched in the
following code. You don't have to change any code in your project.
  "memtrace.h" defines an external reference to the "memtrace" instance.
- Link the "memtrace_internal.cpp" compiled object to your project when
compiling.


What it does:
----------------
- Watching your (de)allocations with file name and line of the appropriate
statement in your code, finding memory leaks.
- The "memtrace" instance has tables. Each allocation in your project creates a
table entry.
  Which table is used, depends on the way of allocation: "new", "new[]",
"malloc"
- Each deallocation tries to delete the entry from the appropriate list, which
may be successful or not.
- Actions and errors can be logged to a stream of choice.
- prints and logs the location of the (de)allocation action (file, line)
- If entries are left in the table at program end, these are potential memory
leaks, which means one of the following:
   * memory block is not deallocated
   * illegal deallocations were used for the allocation type
("free"/"delete"/"delete[]" mixing)
   * "memtrace" was locked during (de)allocation and was unable to trace -> not
a memory leak
- can check if a byte range (with address) is within allocated space registered
in a list (via separate function call).


Note:
-----
- In order to start tracing memory (de)allocation, the "memtrace" instance must
be "unlocked"!
- Read the *.h files.


Contents of dev/debug/memtrace_os4.lha
 PERMSSN    UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP          NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic]                  623    1457  42.8% -lh5- 08d8 Nov 22  2006 memtrace/example.cpp
[generic]               182121  548768  33.2% -lh5- 8e1f Apr 15  2008 memtrace/example.exe
[generic]                   92     106  86.8% -lh5- 0b76 Nov 22  2006 memtrace/example_obj.cpp
[generic]                   87     119  73.1% -lh5- 6de6 Aug 29  2006 memtrace/example_obj.h
[generic]                  529    1101  48.0% -lh5- e5a4 Apr 15  2008 memtrace/makefile
[generic]                  970    2534  38.3% -lh5- 523a Nov 21  2006 memtrace/memtrace/memtrace.h
[generic]                 2475   10444  23.7% -lh5- 9125 Nov 22  2006 memtrace/memtrace/memtrace_internal.cpp
[generic]                 1972    5371  36.7% -lh5- caeb Nov 22  2006 memtrace/memtrace/memtrace_internal.h
[generic]                 1093    2428  45.0% -lh5- ccc9 Jan 11  2007 memtrace/memtrace/readme.txt
[generic]                   99     129  76.7% -lh5- 05fc Nov 22  2006 memtrace/readme.txt
---------- ----------- ------- ------- ------ ---------- ------------ -------------
 Total        10 files  190061  572457  33.2%            Nov 19 20:10
Page generated in 0.02 seconds
Aminet © 1992-2024 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>