]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - zone.c
made darkplaces compile successfully with g++ to test for errors C doesn't care about...
[xonotic/darkplaces.git] / zone.c
diff --git a/zone.c b/zone.c
index 0f1678d8dcc0c53ca4e14a4451d254fc09ed306c..590dd8393ca8d74321b6615da17cdfe0d2bbc39f 100644 (file)
--- a/zone.c
+++ b/zone.c
@@ -101,7 +101,7 @@ choseclump:
                // big allocations are not clumped
 #endif
                pool->realsize += sizeof(memheader_t) + size + sizeof(int);
-               mem = malloc(sizeof(memheader_t) + size + sizeof(int));
+               mem = (memheader_t *)malloc(sizeof(memheader_t) + size + sizeof(int));
                if (mem == NULL)
                        Sys_Error("Mem_Alloc: out of memory (alloc at %s:%i)", filename, fileline);
 #if MEMCLUMPING
@@ -216,7 +216,7 @@ mempool_t *_Mem_AllocPool(const char *name, int flags, mempool_t *parent, const
        mempool_t *pool;
        if (developer.integer && developer_memorydebug.integer)
                _Mem_CheckSentinelsGlobal(filename, fileline);
-       pool = malloc(sizeof(mempool_t));
+       pool = (mempool_t *)malloc(sizeof(mempool_t));
        if (pool == NULL)
                Sys_Error("Mem_AllocPool: out of memory (allocpool at %s:%i)", filename, fileline);
        memset(pool, 0, sizeof(mempool_t));
@@ -383,7 +383,7 @@ mempool_t *zonemempool;
 
 void Mem_PrintStats(void)
 {
-       size_t count = 0, size = 0;
+       size_t count = 0, size = 0, realsize = 0;
        mempool_t *pool;
        memheader_t *mem;
        Mem_CheckSentinelsGlobal();
@@ -391,8 +391,10 @@ void Mem_PrintStats(void)
        {
                count++;
                size += pool->totalsize;
+               realsize += pool->realsize;
        }
        Con_Printf("%lu memory pools, totalling %lu bytes (%.3fMB)\n", (unsigned long)count, (unsigned long)size, size / 1048576.0);
+       Con_Printf("total allocated size: %lu bytes (%.3fMB)\n", (unsigned long)realsize, realsize / 1048576.0);
        for (pool = poolchain;pool;pool = pool->next)
        {
                if ((pool->flags & POOLFLAG_TEMP) && pool->chain)