home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / misc / imagefx_sdk / include / scan / mem.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-18  |  1.6 KB  |  59 lines

  1. /*
  2.  * ImageFX Development Header File
  3.  * Copyright © 1991-1995 Nova Design, Inc.
  4.  * Written by Thomas Krehbiel
  5.  *
  6.  * Memory Management.
  7.  *
  8.  */
  9.  
  10. #ifndef SCAN_MEM_H
  11.  
  12.  
  13. #include <exec/types.h>
  14. #include <exec/memory.h>
  15.  
  16. /*
  17.  * ImageFX uses memory tracking routines for almost all of its memory
  18.  * allocations.  This means that if you allocate memory that is to be
  19.  * freed by ImageFX (eg. a Mask structure), you MUST use these tracking
  20.  * functions or it will be crash city (or at least memory leak city).
  21.  *
  22.  * ImageFX automatically frees any memory it tracks that is not freed
  23.  * by the programmer.  (This does not mean you shouldn't free it, though).
  24.  *
  25.  * You can enable using ImageFX memory tracking functions by defining
  26.  * USE_IMAGEFX_MEMORY_ROUTINES before including this header file.
  27.  * AllocMem()'s and FreeMem()'s will be converted to scan.library functions
  28.  * DAlloc() and DFree() without you having to worry about them.
  29.  *
  30.  */
  31.  
  32. /* Mem debug prototypes: */
  33. void                       DInitMem (void);
  34. void                       DCleanupMem (void);
  35.  
  36. #ifdef USE_IMAGEFX_MEMORY_ROUTINES
  37.  
  38. #define AllocMem(s,t)      DAlloc((s),(t),__FILE__,NULL,__LINE__)
  39. #define FreeMem(p,s)       DFree((p),(s),__FILE__,NULL,__LINE__)
  40.  
  41. #define InitMem()          DInitMem()
  42. #define Alloc(s,t)         DAlloc((s),(t),__FILE__,NULL,__LINE__)
  43. #define Free(p,s)          DFree((p),(s),__FILE__,NULL,__LINE__)
  44. #define FreeAll()          DFreeAll()
  45. #define CleanupMem()       DCleanupMem()
  46.  
  47. #else
  48.  
  49. #define Alloc(s,t)         AllocMem((s),(t))
  50. #define Free(p,s)          FreeMem((p),(s))
  51. #define InitMem()          { }
  52. #define CleanupMem()       { }
  53.  
  54. #endif
  55.  
  56.  
  57. #define SCAN_MEM_H
  58. #endif
  59.