XenevaOS
Loading...
Searching...
No Matches
z_zone.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// DESCRIPTION:
16// Zone Memory Allocation, perhaps NeXT ObjectiveC inspired.
17// Remark: this was the only stuff that, according
18// to John Carmack, might have been useful for
19// Quake.
20//
21
22
23
24#ifndef __Z_ZONE__
25#define __Z_ZONE__
26
27#include <stdio.h>
28
29//
30// ZONE MEMORY
31// PU - purge tags.
32
33enum
34{
35 PU_STATIC = 1, // static entire execution time
36 PU_SOUND, // static while playing
37 PU_MUSIC, // static while playing
38 PU_FREE, // a free block
39 PU_LEVEL, // static until level exited
40 PU_LEVSPEC, // a special thinker in a level
41
42 // Tags >= PU_PURGELEVEL are purgable whenever needed.
43
46
47 // Total number of different tag types
48
50};
51
52
53void Z_Init (void);
54void* Z_Malloc (int size, int tag, void *ptr);
55void Z_Free (void *ptr);
56void Z_FreeTags (int lowtag, int hightag);
57void Z_DumpHeap (int lowtag, int hightag);
58void Z_FileDumpHeap (FILE *f);
59void Z_CheckHeap (void);
60void Z_ChangeTag2 (void *ptr, int tag, char *file, int line);
61void Z_ChangeUser(void *ptr, void **user);
62int Z_FreeMemory (void);
63unsigned int Z_ZoneSize(void);
64
65//
66// This is used to get the local FILE:LINE info from CPP
67// prior to really call the function in question.
68//
69#define Z_ChangeTag(p,t) \
70 Z_ChangeTag2((p), (t), __FILE__, __LINE__)
71
72
73#endif
size_t size
Definition drm_bridge.h:1299
const char * f
Definition drm_print.h:205
Definition stdio.h:41
Definition fs.h:142
void Z_FreeTags(int lowtag, int hightag)
Definition z_zone.c:299
void Z_Init(void)
Definition z_zone.c:97
void Z_ChangeTag2(void *ptr, int tag, char *file, int line)
Definition z_zone.c:429
void * Z_Malloc(int size, int tag, void *ptr)
Definition z_zone.c:186
void Z_ChangeUser(void *ptr, void **user)
Definition z_zone.c:446
unsigned int Z_ZoneSize(void)
Definition z_zone.c:484
int Z_FreeMemory(void)
Definition z_zone.c:466
void Z_FileDumpHeap(FILE *f)
Definition z_zone.c:367
@ PU_NUM_TAGS
Definition z_zone.h:49
@ PU_LEVEL
Definition z_zone.h:39
@ PU_SOUND
Definition z_zone.h:36
@ PU_STATIC
Definition z_zone.h:35
@ PU_LEVSPEC
Definition z_zone.h:40
@ PU_CACHE
Definition z_zone.h:45
@ PU_PURGELEVEL
Definition z_zone.h:44
@ PU_MUSIC
Definition z_zone.h:37
@ PU_FREE
Definition z_zone.h:38
void Z_Free(void *ptr)
Definition z_zone.c:126
void Z_DumpHeap(int lowtag, int hightag)
Definition z_zone.c:329
void Z_CheckHeap(void)
Definition z_zone.c:400