home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / misc / safemem.readme < prev    next >
Text File  |  2014-05-19  |  4KB  |  105 lines

  1. Short: Resourse tracking mem allocator
  2.  
  3.                   MEM: A memory management safety net.
  4.  
  5.                              written by
  6.  
  7.                            ---------------
  8.                            Simon    Bullen
  9.                            10 Hogan Street
  10.                            Sunbury    3429
  11.                            Australia
  12.                            ---------------
  13.  
  14.   In this archive, there should be the following files:
  15.  
  16.           mem.doc          3594 bytes
  17.           mem.c            6801 bytes
  18.           mem.h             523 bytes
  19.  
  20.  
  21.     Ever had the problem of a program you're trying to debug swallowing
  22.   24 bytes somewhere, and not knowing where? Or perhaps you're playing
  23.   around with one of the more complex memory structures, and it gurus
  24.   a lot due to incorrect memory frees? Painful to debug, aren't they?
  25.  
  26.     Well, no longer!! With these two teeny files, your programs will crash
  27.   from memory mismanagement never again!
  28.  
  29.     mem.c provides a safety net around all your calls to AllocMem and
  30.   FreeMem, recording what you've allocated, and where you allocated (ie
  31.   where in the source-code). Then, when you do something wrong (like try to
  32.   free something you never allocated), it simply displays a nice little
  33.   debug message like this:
  34.  
  35. hello.c 44: Incorrect free size. (64 instead of 2300)
  36.  
  37.   or this:
  38.  
  39. hello.c 45: Free twice (?). ($34, 2478756)
  40.  
  41.     There must be very few Amiga programmers out there who haven't
  42.   had the "Free Twice" guru!
  43.  
  44.  
  45.     mem.c also provides a mechanism to find out just what you haven't
  46.   gotten around to freeing yet (you've been -meaning- to for ages...):
  47.  
  48.  
  49. hello.c 76: Memory List
  50.  
  51.     Address      Size        File           Line
  52.     -------      ----        ----           ----
  53.     $123450      24          hello.c        42
  54.     $200000      4500        there.c        97
  55.  
  56.  
  57.   Useful, eh? But that's not all!! Gone are the days when you have to
  58.   reboot your computer every time your rogue program eats up all your
  59.   precious memory; A simple call will free everything you allocated!
  60.  
  61.     Ok, enough of the advertisement; here's how to do it:
  62.  
  63.   Simply #include "mem.h" (make sure you put that AFTER #include
  64.   "proto/exec.h" !!!!!!). Link with mem.o, and place calls to
  65.   ShowMemList() and ClearMemList() where-ever you feel appropriate. (At the
  66.   end of main() is the most obvious place, though the more industrious
  67.   could put the calls in break & exit traps.)
  68.  
  69.     To find out how it works, read the extensive documentation in mem.c.
  70.  
  71.  
  72.  
  73.  
  74.                   MEM: A memory management safety net.
  75.  
  76.                              written by
  77.  
  78.                            ---------------
  79.                            Simon    Bullen
  80.                            10 Hogan Street
  81.                            Sunbury    3429
  82.                            Australia
  83.                            ---------------
  84.  
  85.                       ----------------------------
  86.                       s914373@minyos.xx.rmit.OZ.AU
  87.                       ----------------------------
  88.  
  89.  
  90.                 You are free to do whatever you like with
  91.                 this software, so long as you give credit
  92.                 where credit is due.
  93.  
  94.                 If you find it useful (like it saves you
  95.                 3 days of debugging time), send whatever
  96.                 you feel appropriate  ($10 would be most
  97.                 welcome!).
  98.  
  99.                 I would be very  interested  to here any
  100.                 comments,  suggestions,  and  flames you
  101.                 may have.  (Please,  dont  take  it upon
  102.                 yourself  to   point  out  my   spelling
  103.                 errors!).
  104.  
  105.