
|
84799 packages online
|
|
 |
|
|
|
No screenshot available
|
|
MEM: A memory management safety net.
written by
---------------
Simon Bullen
10 Hogan Street
Sunbury 3429
Australia
---------------
In this archive, there should be the following files:
mem.doc 3594 bytes
mem.c 6801 bytes
mem.h 523 bytes
Ever had the problem of a program you're trying to debug swallowing
24 bytes somewhere, and not knowing where? Or perhaps you're playing
around with one of the more complex memory structures, and it gurus
a lot due to incorrect memory frees? Painful to debug, aren't they?
Well, no longer!! With these two teeny files, your programs will crash
from memory mismanagement never again!
mem.c provides a safety net around all your calls to AllocMem and
FreeMem, recording what you've allocated, and where you allocated (ie
where in the source-code). Then, when you do something wrong (like try to
free something you never allocated), it simply displays a nice little
debug message like this:
hello.c 44: Incorrect free size. (64 instead of 2300)
or this:
hello.c 45: Free twice (?). ($34, 2478756)
There must be very few Amiga programmers out there who haven't
had the "Free Twice" guru!
mem.c also provides a mechanism to find out just what you haven't
gotten around to freeing yet (you've been -meaning- to for ages...):
hello.c 76: Memory List
Address Size File Line
------- ---- ---- ----
$123450 24 hello.c 42
$200000 4500 there.c 97
Useful, eh? But that's not all!! Gone are the days when you have to
reboot your computer every time your rogue program eats up all your
precious memory; A simple call will free everything you allocated!
Ok, enough of the advertisement; here's how to do it:
Simply #include "mem.h" (make sure you put that AFTER #include
"proto/exec.h" !!!!!!). Link with mem.o, and place calls to
ShowMemList() and ClearMemList() where-ever you feel appropriate. (At the
end of main() is the most obvious place, though the more industrious
could put the calls in break & exit traps.)
To find out how it works, read the extensive documentation in mem.c.
MEM: A memory management safety net.
written by
---------------
Simon Bullen
10 Hogan Street
Sunbury 3429
Australia
---------------
----------------------------
s914373@minyos.xx.rmit.OZ.AU
----------------------------
You are free to do whatever you like with
this software, so long as you give credit
where credit is due.
If you find it useful (like it saves you
3 days of debugging time), send whatever
you feel appropriate ($10 would be most
welcome!).
I would be very interested to here any
comments, suggestions, and flames you
may have. (Please, dont take it upon
yourself to point out my spelling
errors!).
|
Contents of dev/debug/safemem.lzh
PERMSSN UID GID PACKED SIZE RATIO METHOD CRC STAMP NAME
---------- ----------- ------- ------- ------ ---------- ------------ -------------
[generic] 2344 6807 34.4% -lh1- c8bb Jul 4 1991 mem.c
[generic] 1518 3594 42.2% -lh1- 2f96 Jul 4 1991 mem.doc
[generic] 262 523 50.1% -lh1- 4536 Jul 4 1991 mem.h
---------- ----------- ------- ------- ------ ---------- ------------ -------------
Total 3 files 4124 10924 37.8% Aug 15 1992
|
|
|
 |
Page generated in 0.02 seconds |
Aminet © 1992-2024 Urban
Müller and the Aminet team.
Aminet contact address: <aminet aminet net> |