1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
18 // Zone Memory Allocation, perhaps NeXT ObjectiveC inspired.
19 // Remark: this was the only stuff that, according
20 // to John Carmack, might have been useful for
23 //---------------------------------------------------------------------
35 // Tags < 100 are not overwritten until freed.
36 #define PU_STATIC 1 // static entire execution time
37 #define PU_SOUND 2 // static while playing
38 #define PU_MUSIC 3 // static while playing
39 #define PU_DAVE 4 // anything else Dave wants static
40 #define PU_LEVEL 50 // static until level exited
41 #define PU_LEVSPEC 51 // a special thinker in a level
42 // Tags >= 100 are purgable whenever needed.
43 #define PU_PURGELEVEL 100
48 void* Z_Malloc (int size
, int tag
, void *ptr
);
49 void Z_Free (void *ptr
);
50 void Z_FreeTags (int lowtag
, int hightag
);
51 void Z_DumpHeap (int lowtag
, int hightag
);
52 void Z_FileDumpHeap (FILE *f
);
53 void Z_CheckHeap (void);
54 void Z_ChangeTag2 (void *ptr
, int tag
);
55 int Z_FreeMemory (void);
58 typedef struct memblock_s
60 int size
; // including the header and possibly tiny fragments
61 void** user
; // NULL if a free block
62 int tag
; // purgelevel
63 int id
; // should be ZONEID
64 struct memblock_s
* next
;
65 struct memblock_s
* prev
;
71 // This is used to get the local FILE:LINE info from CPP
72 // prior to really call the function in question.
74 #define Z_ChangeTag(p,t) \
76 if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
77 I_Error("Z_CT at "__FILE__":%i",__LINE__); \
81 //#define Z_ChangeTag(p,t) Z_ChangeTag2(p,t)
85 //-----------------------------------------------------------------------------
88 // Revision 1.1 2000/02/29 18:21:07 stegerg
89 // Doom port based on ADoomPPC. Read README.AROS!
92 //-----------------------------------------------------------------------------