home *** CD-ROM | disk | FTP | other *** search
- Short: Resourse tracking mem allocator
-
- 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!).
-
-