]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Mem_AllocPool flags and parent parameters added, now there can be multiple temporary...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 25 Aug 2004 08:50:52 +0000 (08:50 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 25 Aug 2004 08:50:52 +0000 (08:50 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4377 d7cf8633-e32d-0410-b094-e92efae38249

30 files changed:
cgamevm.c
cl_main.c
cl_parse.c
cl_particles.c
cl_video.c
cmd.c
common.c
console.c
fs.c
gl_backend.c
gl_models.c
gl_textures.c
host.c
image.c
menu.c
meshqueue.c
model_shared.c
netconn.c
pr_cmds.c
pr_edict.c
prvm_cmds.c
r_shadow.c
snd_dma.c
snd_ogg.c
snd_wav.c
sv_main.c
ui.c
wad.c
zone.c
zone.h

index 721c339212d61246b8258e6f4c2ffceca0bea580..31881975a89f2c41eb1d42c34494e85b2eac3323 100644 (file)
--- a/cgamevm.c
+++ b/cgamevm.c
@@ -23,7 +23,7 @@ static model_t *cgvm_model[MAX_CGVM_MODELS];
 
 void CL_CGVM_Init(void)
 {
-       cgvm_mempool = Mem_AllocPool("CGVM");
+       cgvm_mempool = Mem_AllocPool("CGVM", 0, NULL);
 }
 
 void CL_CGVM_Clear(void)
index 8ab9bf730417ba593fea2b66cbf8085fdfdaee2c..21b125cb75b4c2cb122f89fc9a3dd45999de78ab 100644 (file)
--- a/cl_main.c
+++ b/cl_main.c
@@ -1236,8 +1236,8 @@ CL_Init
 */
 void CL_Init (void)
 {
-       cl_entities_mempool = Mem_AllocPool("client entities");
-       cl_refdef_mempool = Mem_AllocPool("refdef");
+       cl_entities_mempool = Mem_AllocPool("client entities", 0, NULL);
+       cl_refdef_mempool = Mem_AllocPool("refdef", 0, NULL);
 
        memset(&r_refdef, 0, sizeof(r_refdef));
        // max entities sent to renderer per frame
index b7fe200e1bcd02595af031eff1365fee46a81650..fae79068ecc4c8a92c934b70b427fd6cdbcba5a8 100644 (file)
@@ -1820,7 +1820,7 @@ void CL_Parse_DumpPacket(void)
 void CL_Parse_Init(void)
 {
        // LordHavoc: added demo_nehahra cvar
-       cl_scores_mempool = Mem_AllocPool("client player info");
+       cl_scores_mempool = Mem_AllocPool("client player info", 0, NULL);
        Cvar_RegisterVariable (&demo_nehahra);
        if (gamemode == GAME_NEHAHRA)
                Cvar_SetValue("demo_nehahra", 1);
index 0fb500f632e0c081db8582392a9c7aec89a4737f..6f905785887795e8cea24ed15b4c0430f499590e 100644 (file)
@@ -355,7 +355,7 @@ void CL_Particles_Init (void)
 #ifdef WORKINGLQUAKE
        particles = (particle_t *) Hunk_AllocName(cl_maxparticles * sizeof(particle_t), "particles");
 #else
-       cl_part_mempool = Mem_AllocPool("CL_Part");
+       cl_part_mempool = Mem_AllocPool("CL_Part", 0, NULL);
        particles = (particle_t *) Mem_Alloc(cl_part_mempool, cl_maxparticles * sizeof(particle_t));
 #endif
        cl_numparticles = 0;
index 165f1b067bb75b9c00b3ea822fae6b9c2980dd3f..130a58ffd3ce5ca4b552b7ccc8686ce6299c32af 100644 (file)
@@ -156,5 +156,5 @@ void CL_Video_Init(void)
        Cmd_AddCommand("playvideo", CL_PlayVideo_f);
        Cmd_AddCommand("stopvideo", CL_StopVideo_f);
 
-       clvideomempool = Mem_AllocPool("CL_Video");
+       clvideomempool = Mem_AllocPool("CL_Video", 0, NULL);
 }
diff --git a/cmd.c b/cmd.c
index 2e134d7885047530f1a227f5168ae765ed5c1281..10ee1366f9ca30dcecc95ff786490918f46de3cd 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -462,7 +462,7 @@ Cmd_Init
 */
 void Cmd_Init (void)
 {
-       cmd_mempool = Mem_AllocPool("commands");
+       cmd_mempool = Mem_AllocPool("commands", 0, NULL);
 
 //
 // register our commands
index 0d5c2a9f348b2404ee1fdd1adcc50d753993c2b7..dcc333b71556a538c078781640f1a64395307531 100644 (file)
--- a/common.c
+++ b/common.c
@@ -342,7 +342,7 @@ void SZ_Alloc (sizebuf_t *buf, int startsize, const char *name)
 {
        if (startsize < 256)
                startsize = 256;
-       buf->mempool = Mem_AllocPool(name);
+       buf->mempool = Mem_AllocPool(name, 0, NULL);
        buf->data = Mem_Alloc(buf->mempool, startsize);
        buf->maxsize = startsize;
        buf->cursize = 0;
index d72ddf6e4be610c1d8481aff5aaba954531b59f2..963d03db9de2bebed0ccd12f20f5dc887009a3dc 100644 (file)
--- a/console.c
+++ b/console.c
@@ -419,7 +419,7 @@ Con_Init
 */
 void Con_Init (void)
 {
-       console_mempool = Mem_AllocPool("console");
+       console_mempool = Mem_AllocPool("console", 0, NULL);
        con_text = Mem_Alloc(console_mempool, CON_TEXTSIZE);
        memset (con_text, ' ', CON_TEXTSIZE);
        con_linewidth = -1;
diff --git a/fs.c b/fs.c
index 9eb46843f796fff86a8c3d1cf32e9bfdb3d78c97..d507299576be4b750d7c4ffd89e8b519642680c2 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -550,7 +550,7 @@ pack_t *FS_LoadPackPK3 (const char *packfile)
        strlcpy (pack->filename, packfile, sizeof (pack->filename));
        pack->handle = packhandle;
        pack->numfiles = eocd.nbentries;
-       pack->mempool = Mem_AllocPool (packfile);
+       pack->mempool = Mem_AllocPool (packfile, 0, NULL);
        pack->files = Mem_Alloc (pack->mempool, eocd.nbentries * sizeof(packfile_t));
        pack->next = packlist;
        packlist = pack;
@@ -744,7 +744,7 @@ pack_t *FS_LoadPackPAK (const char *packfile)
        strlcpy (pack->filename, packfile, sizeof (pack->filename));
        pack->handle = packhandle;
        pack->numfiles = 0;
-       pack->mempool = Mem_AllocPool(packfile);
+       pack->mempool = Mem_AllocPool(packfile, 0, NULL);
        pack->files = Mem_Alloc(pack->mempool, numpackfiles * sizeof(packfile_t));
        pack->next = packlist;
        packlist = pack;
@@ -886,8 +886,8 @@ void FS_Init (void)
        int i;
        searchpath_t *search;
 
-       fs_mempool = Mem_AllocPool("file management");
-       pak_mempool = Mem_AllocPool("paks");
+       fs_mempool = Mem_AllocPool("file management", 0, NULL);
+       pak_mempool = Mem_AllocPool("paks", 0, NULL);
 
        Cvar_RegisterVariable (&scr_screenshot_name);
 
index 90562380b4f2c048e327dd9d9c547f0a0bd71c0e..7ba45451894ffb638e3c6f80c886267e79a67e4f 100644 (file)
@@ -149,7 +149,7 @@ static void R_Mesh_CacheArray_Shutdown(void);
 void GL_Backend_AllocArrays(void)
 {
        if (!gl_backend_mempool)
-               gl_backend_mempool = Mem_AllocPool("GL_Backend");
+               gl_backend_mempool = Mem_AllocPool("GL_Backend", 0, NULL);
        R_Mesh_CacheArray_Startup();
 }
 
index 223be1b81b87af20c877d54b988831638ee23e9e..fac269f945a9c5f23060c9374eb8bfdf08af0636 100644 (file)
@@ -61,7 +61,7 @@ void gl_models_freearrays(void)
 void gl_models_start(void)
 {
        // allocate vertex processing arrays
-       gl_models_mempool = Mem_AllocPool("GL_Models");
+       gl_models_mempool = Mem_AllocPool("GL_Models", 0, NULL);
        zymbonepose = Mem_Alloc(gl_models_mempool, sizeof(zymbonematrix[256]));
        gl_models_allocarrays(4096);
 }
index 149ab8882dc3b712b110b8615ec15671b8cf3a12..0c9147caa8a18ce46ef91e6c35fda56cd4526400 100644 (file)
@@ -482,9 +482,9 @@ static void r_textures_start(void)
        // use the largest scrap texture size we can (not sure if this is really a good idea)
        for (block_size = 1;block_size < realmaxsize && block_size < gl_max_scrapsize.integer;block_size <<= 1);
 
-       texturemempool = Mem_AllocPool("Texture Info");
-       texturedatamempool = Mem_AllocPool("Texture Storage (not yet uploaded)");
-       textureprocessingmempool = Mem_AllocPool("Texture Processing Buffers");
+       texturemempool = Mem_AllocPool("Texture Info", 0, NULL);
+       texturedatamempool = Mem_AllocPool("Texture Storage (not yet uploaded)", 0, NULL);
+       textureprocessingmempool = Mem_AllocPool("Texture Processing Buffers", 0, NULL);
 
        // Disable JPEG screenshots if the DLL isn't loaded
        if (! JPEG_OpenLibrary ())
diff --git a/host.c b/host.c
index 412f75e92f59def31c0a50b868de2e37f4b63dce..b1ed19b011dbe26d408ea27d1d0d3229965e3c8e 100644 (file)
--- a/host.c
+++ b/host.c
@@ -214,7 +214,7 @@ void Host_ServerOptions (void)
                Cvar_SetValueQuick(&deathmatch, 1);
 
        svs.maxclients = numplayers;
-       sv_clients_mempool = Mem_AllocPool("server clients");
+       sv_clients_mempool = Mem_AllocPool("server clients", 0, NULL);
        svs.clients = Mem_Alloc(sv_clients_mempool, sizeof(client_t) * svs.maxclients);
 }
 
diff --git a/image.c b/image.c
index 8b150c40c7da6961f9c0019112d5d5cb55b9a2a5..3ecbea398671fe3ecb5310f5cae3f1183e5fdf1b 100644 (file)
--- a/image.c
+++ b/image.c
@@ -1307,7 +1307,7 @@ void Image_Resample (const void *indata, int inwidth, int inheight, int indepth,
                        Mem_Free(resamplerow1);
                resamplerowsize = outwidth*4;
                if (!resamplemempool)
-                       resamplemempool = Mem_AllocPool("Image Scaling Buffer");
+                       resamplemempool = Mem_AllocPool("Image Scaling Buffer", 0, NULL);
                resamplerow1 = Mem_Alloc(resamplemempool, resamplerowsize*2);
                resamplerow2 = resamplerow1 + resamplerowsize;
        }
diff --git a/menu.c b/menu.c
index 34ae9d32d404b65f5e2ad0121fc6b7d35c91e47b..ed3e79ce2796950f03038b2aac7c8443f726b821 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -3725,7 +3725,7 @@ void M_Shutdown(void);
 
 void M_Init (void)
 {
-       menu_mempool = Mem_AllocPool("Menu");
+       menu_mempool = Mem_AllocPool("Menu", 0, NULL);
        menuplyr_load = true;
        menuplyr_pixels = NULL;
 
@@ -4129,9 +4129,9 @@ void MP_Init (void)
        prog->error_cmd = MP_Error;
 
        // allocate the mempools
-       prog->edicts_mempool = Mem_AllocPool(M_NAME " edicts mempool");
-       prog->edictstring_mempool = Mem_AllocPool( M_NAME " edict string mempool");
-       prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME);
+       prog->edicts_mempool = Mem_AllocPool(M_NAME " edicts mempool", 0, NULL);
+       prog->edictstring_mempool = Mem_AllocPool( M_NAME " edict string mempool", 0, NULL);
+       prog->progs_mempool = Mem_AllocPool(M_PROG_FILENAME, 0, NULL);
 
        PRVM_LoadProgs(M_PROG_FILENAME, m_numrequiredfunc, m_required_func);
 
index 52366e9ce19ded39ca56fc0052168ad27c79bc41..6c9f180711258a1a303ab694f9f45c1b76ba7fca 100644 (file)
@@ -29,7 +29,7 @@ void R_MeshQueue_Init(void)
        Cvar_RegisterVariable(&r_meshqueue_immediaterender);
        Cvar_RegisterVariable(&r_meshqueue_sort);
 
-       meshqueuemempool = Mem_AllocPool("R_MeshQueue");
+       meshqueuemempool = Mem_AllocPool("R_MeshQueue", 0, NULL);
        mq_total = 0;
        mqt_total = 1000;
        mq_array = NULL;
index 2d8601a1a18ba2653cb8e9cad7de90964c5a98c0..17b6e284c7333c741b227d270f78527b1fcf74b3 100644 (file)
@@ -297,7 +297,7 @@ static model_t *Mod_LoadModel(model_t *mod, qboolean crash, qboolean checkdisk,
        VectorSet(mod->rotatedmaxs, mod->radius, mod->radius, mod->radius);
 
        // all models use memory, so allocate a memory pool
-       mod->mempool = Mem_AllocPool(mod->name);
+       mod->mempool = Mem_AllocPool(mod->name, 0, NULL);
        // all models load textures, so allocate a texture pool
        if (cls.state != ca_dedicated)
                mod->texturepool = R_AllocTexturePool();
index 12c97a2e3a408fa7e9621976ec00dd5cc7769937..12636d4c3ef5ec5b2161d5d90d5a57b83205cf86 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -1593,7 +1593,7 @@ void NetConn_Init(void)
 {
        int i;
        lhnetaddress_t tempaddress;
-       netconn_mempool = Mem_AllocPool("Networking");
+       netconn_mempool = Mem_AllocPool("Networking", 0, NULL);
        Cmd_AddCommand("net_stats", Net_Stats_f);
        Cmd_AddCommand("net_slist", Net_Slist_f);
        Cmd_AddCommand("heartbeat", Net_Heartbeat_f);
index 0839455e32e146397e174ba87a37b4ed6843df5c..55ea9032ea4ace45f6dc10d73dd5245ff105c7fb 100644 (file)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -3422,7 +3422,7 @@ int pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]);
 
 void PR_Cmd_Init(void)
 {
-       pr_strings_mempool = Mem_AllocPool("pr_stringszone");
+       pr_strings_mempool = Mem_AllocPool("pr_stringszone", 0, NULL);
        PR_Files_Init();
        PR_Search_Init();
 }
index 4643f3e44f2510ef850821ff423bb68def1be512..bd3e3eca959c50b176bcf259327c686e933f76aa 100644 (file)
@@ -1623,8 +1623,8 @@ void PR_Init (void)
        Cvar_RegisterVariable (&pr_boundscheck);
        Cvar_RegisterVariable (&pr_traceqc);
 
-       progs_mempool = Mem_AllocPool("progs.dat");
-       edictstring_mempool = Mem_AllocPool("edict strings");
+       progs_mempool = Mem_AllocPool("progs.dat", 0, NULL);
+       edictstring_mempool = Mem_AllocPool("edict strings", 0, NULL);
 
        PR_Cmd_Init();
 }
index 6a7fc7d4721e1e0ce9aed945c029690195a6ee89..6b8abd75cbf4890ca71723a1a5a395772a83eee7 100644 (file)
@@ -2781,7 +2781,7 @@ void VM_getimagesize(void)
 void VM_Cmd_Init(void)
 {
        // only init the stuff for the current prog
-       VM_STRINGS_MEMPOOL = Mem_AllocPool(va("vm_stringsmempool[%s]",PRVM_NAME));
+       VM_STRINGS_MEMPOOL = Mem_AllocPool(va("vm_stringsmempool[%s]",PRVM_NAME), 0, NULL);
        VM_Files_Init();
        VM_Search_Init();
 }
index ef1190c29d2737ba7e32eb628860eed7f9408ce3..49d0701eea2045f226f05943c6ee85a04360eb24 100644 (file)
@@ -392,7 +392,7 @@ void R_Shadow_Init(void)
        }
        Cmd_AddCommand("r_shadow_help", R_Shadow_Help_f);
        R_Shadow_EditLights_Init();
-       r_shadow_mempool = Mem_AllocPool("R_Shadow");
+       r_shadow_mempool = Mem_AllocPool("R_Shadow", 0, NULL);
        r_shadow_worldlightchain = NULL;
        maxshadowelements = 0;
        shadowelements = NULL;
index e3db4c90ddf802d390c4c27e3d88ef479da763a9..5825fc6246659142554af18d837c995ea634734b 100644 (file)
--- a/snd_dma.c
+++ b/snd_dma.c
@@ -215,7 +215,7 @@ void S_Init(void)
        if (COM_CheckParm("-nosound") || COM_CheckParm("-safe"))
                return;
 
-       snd_mempool = Mem_AllocPool("sound");
+       snd_mempool = Mem_AllocPool("sound", 0, NULL);
 
        if (COM_CheckParm("-simsound"))
                fakedma = true;
index 17fc7dff64105615a3ec4f65c20a6940d866d5a1..ceab9efb41856b8ac64c0c0ee54470c4d4a3af6c 100644 (file)
--- a/snd_ogg.c
+++ b/snd_ogg.c
@@ -515,7 +515,7 @@ qboolean OGG_LoadVorbisFile (const char *filename, sfx_t *s)
                return false;
 
        Mem_FreePool (&s->mempool);
-       s->mempool = Mem_AllocPool (s->name);
+       s->mempool = Mem_AllocPool (s->name, 0, NULL);
 
        // Load the file
        data = FS_LoadFile (filename, s->mempool, false);
index a9440735893744c4e95f993c6ffecddceed91f67..8d4f986bab8a32e5377918e86c4ddfc9bf55d40c 100644 (file)
--- a/snd_wav.c
+++ b/snd_wav.c
@@ -241,7 +241,7 @@ qboolean S_LoadWavFile (const char *filename, sfx_t *s)
        sfxbuffer_t* sb;
 
        Mem_FreePool (&s->mempool);
-       s->mempool = Mem_AllocPool(s->name);
+       s->mempool = Mem_AllocPool(s->name, 0, NULL);
 
        // Load the file
        data = FS_LoadFile(filename, s->mempool, false);
index 34622ddfdbf50bdaa1a5fc71dd197e1b017facba..736cee1fdd6e9be7245a5e8b3d0eb082ad128ddd 100644 (file)
--- a/sv_main.c
+++ b/sv_main.c
@@ -82,7 +82,7 @@ void SV_Init (void)
        for (i = 0;i < MAX_MODELS;i++)
                sprintf (localmodels[i], "*%i", i);
 
-       sv_edicts_mempool = Mem_AllocPool("server edicts");
+       sv_edicts_mempool = Mem_AllocPool("server edicts", 0, NULL);
 }
 
 static void SV_SaveEntFile_f(void)
diff --git a/ui.c b/ui.c
index 9915af5642613c5ce4ae82a44e115f5100f67551..0d1b67fd2c33ecd5d3d3b6d8dc31d03adb55dc1b 100644 (file)
--- a/ui.c
+++ b/ui.c
@@ -49,7 +49,7 @@ static mempool_t *ui_mem;
 
 void UI_Init(void)
 {
-       ui_mem = Mem_AllocPool("Intern UI Memory");
+       ui_mem = Mem_AllocPool("Intern UI Memory", 0, NULL);
 }
 
 #define UI_Alloc(size) Mem_Alloc(ui_mem, size)
diff --git a/wad.c b/wad.c
index 44f39f310273351c93f08a6714f614521a4111f7..ed96026da875db20a503812baf47af1670480c84 100644 (file)
--- a/wad.c
+++ b/wad.c
@@ -79,7 +79,7 @@ void *W_GetLumpName(char *name)
                                Con_Print("gfx.wad doesn't have WAD2 id\n");
                        else
                        {
-                               wad_mempool = Mem_AllocPool("gfx.wad");
+                               wad_mempool = Mem_AllocPool("gfx.wad", 0, NULL);
                                wad_base = Mem_Alloc(wad_mempool, fs_filesize);
 
                                memcpy(wad_base, temp, fs_filesize);
diff --git a/zone.c b/zone.c
index bde6fdf137f37c43b393fc0ff3e0edfb190216ae..03a6bfa3d0a029880641616d42abd802eb5dadc9 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -205,7 +205,7 @@ void _Mem_Free(void *data, const char *filename, int fileline)
 #endif
 }
 
-mempool_t *_Mem_AllocPool(const char *name, mempool_t *parent, const char *filename, int fileline)
+mempool_t *_Mem_AllocPool(const char *name, int flags, mempool_t *parent, const char *filename, int fileline)
 {
        mempool_t *pool;
        pool = malloc(sizeof(mempool_t));
@@ -216,6 +216,7 @@ mempool_t *_Mem_AllocPool(const char *name, mempool_t *parent, const char *filen
        pool->sentinel2 = MEMHEADER_SENTINEL1;
        pool->filename = filename;
        pool->fileline = fileline;
+       pool->flags = flags;
        pool->chain = NULL;
        pool->totalsize = 0;
        pool->realsize = sizeof(mempool_t);
@@ -348,14 +349,14 @@ void Mem_PrintStats(void)
                size += pool->totalsize;
        }
        Con_Printf("%i memory pools, totalling %i bytes (%.3fMB)\n", count, size, size / 1048576.0);
-       if (tempmempool == NULL)
-               Con_Print("Error: no tempmempool allocated\n");
-       else if (tempmempool->chain)
+       for (pool = poolchain;pool;pool = pool->next)
        {
-               Con_Printf("%i bytes (%.3fMB) of temporary memory still allocated (Leak!)\n", tempmempool->totalsize, tempmempool->totalsize / 1048576.0);
-               Con_Print("listing temporary memory allocations:\n");
-               for (mem = tempmempool->chain;mem;mem = mem->next)
-                       Con_Printf("%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline);
+               if ((pool->flags & POOLFLAG_TEMP) && pool->chain)
+               {
+                       Con_Printf("Memory pool %p has sprung a leak totalling %i bytes (%.3fMB)!  Listing contents...\n", pool, pool->totalsize, pool->totalsize / 1048576.0);
+                       for (mem = pool->chain;mem;mem = mem->next)
+                               Con_Printf("%10i bytes allocated at %s:%i\n", mem->size, mem->filename, mem->fileline);
+               }
        }
 }
 
@@ -368,10 +369,7 @@ void Mem_PrintList(int listallocations)
                   "size    name\n");
        for (pool = poolchain;pool;pool = pool->next)
        {
-               if (pool->lastchecksize != 0 && pool->totalsize != pool->lastchecksize)
-                       Con_Printf("%10ik (%10ik actual) %s (%i byte change)\n", (pool->totalsize + 1023) / 1024, (pool->realsize + 1023) / 1024, pool->name, pool->totalsize - pool->lastchecksize);
-               else
-                       Con_Printf("%10ik (%10ik actual) %s\n", (pool->totalsize + 1023) / 1024, (pool->realsize + 1023) / 1024, pool->name);
+               Con_Printf("%10ik (%10ik actual) %s (%+i byte change) %s\n", (pool->totalsize + 1023) / 1024, (pool->realsize + 1023) / 1024, pool->name, pool->totalsize - pool->lastchecksize, (pool->flags & POOLFLAG_TEMP) ? "TEMP" : "");
                pool->lastchecksize = pool->totalsize;
                if (listallocations)
                        for (mem = pool->chain;mem;mem = mem->next)
@@ -417,8 +415,8 @@ Memory_Init
 */
 void Memory_Init (void)
 {
-       tempmempool = Mem_AllocPool("Temporary Memory");
-       zonemempool = Mem_AllocPool("Zone");
+       tempmempool = Mem_AllocPool("Temporary Memory", POOLFLAG_TEMP, NULL);
+       zonemempool = Mem_AllocPool("Zone", 0, NULL);
        poolchain = NULL;
 }
 
diff --git a/zone.h b/zone.h
index f49f14712d881ceabe5f0998c7e4d6d71dcdf282..f47561c2f30fb82bbbf8427c12930b9e67aa83ff 100644 (file)
--- a/zone.h
+++ b/zone.h
@@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //#define MEMCLUMPING
 
 #define POOLNAMESIZE 128
+// if set this pool will be printed in memlist reports
+#define POOLFLAG_TEMP 1
 #if MEMCLUMPING
 // give malloc padding so we can't waste most of a page at the end
 #define MEMCLUMPSIZE (65536 - 1536)
@@ -93,6 +95,8 @@ typedef struct mempool_s
        // chain of clumps (if any)
        struct memclump_s *clumpchain;
 #endif
+       // POOLFLAG_*
+       int flags;
        // total memory allocated in this pool (inside memheaders)
        int totalsize;
        // total memory allocated in this pool (actual malloc total)
@@ -117,14 +121,13 @@ mempool_t;
 #define Mem_Free(mem) _Mem_Free(mem, __FILE__, __LINE__)
 #define Mem_CheckSentinels(data) _Mem_CheckSentinels(data, __FILE__, __LINE__)
 #define Mem_CheckSentinelsGlobal() _Mem_CheckSentinelsGlobal(__FILE__, __LINE__)
-#define Mem_AllocPool(name) _Mem_AllocPool(name, NULL, __FILE__, __LINE__)
-#define Mem_AllocNestedPool(name, parent) _Mem_AllocPool(name, (parent), __FILE__, __LINE__)
+#define Mem_AllocPool(name, flags, parent) _Mem_AllocPool(name, flags, parent, __FILE__, __LINE__)
 #define Mem_FreePool(pool) _Mem_FreePool(pool, __FILE__, __LINE__)
 #define Mem_EmptyPool(pool) _Mem_EmptyPool(pool, __FILE__, __LINE__)
 
 void *_Mem_Alloc(mempool_t *pool, int size, const char *filename, int fileline);
 void _Mem_Free(void *data, const char *filename, int fileline);
-mempool_t *_Mem_AllocPool(const char *name, mempool_t *parent, const char *filename, int fileline);
+mempool_t *_Mem_AllocPool(const char *name, int flags, mempool_t *parent, const char *filename, int fileline);
 void _Mem_FreePool(mempool_t **pool, const char *filename, int fileline);
 void _Mem_EmptyPool(mempool_t *pool, const char *filename, int fileline);
 void _Mem_CheckSentinels(void *data, const char *filename, int fileline);