diff --git a/doomsday/engine/portable/include/dd_zone.h b/doomsday/engine/portable/include/dd_zone.h index a80861835a..5eb62f2144 100644 --- a/doomsday/engine/portable/include/dd_zone.h +++ b/doomsday/engine/portable/include/dd_zone.h @@ -49,8 +49,6 @@ boolean Z_IsInited(void); int Z_Init(void); void Z_Shutdown(void); -void Z_EnableFastMalloc(boolean isEnabled); -//void Z_PrintStatus(void); void* Z_Malloc(size_t size, int tag, void* ptr); void Z_Free(void* ptr); void Z_FreeTags(int lowTag, int highTag); diff --git a/doomsday/engine/portable/src/dd_zone.c b/doomsday/engine/portable/src/dd_zone.c index ef53c7a54d..a0103c502e 100644 --- a/doomsday/engine/portable/src/dd_zone.c +++ b/doomsday/engine/portable/src/dd_zone.c @@ -12,12 +12,6 @@ * It is of no value to free a cachable block, because it will get * overwritten automatically if needed. * - * When fast malloc mode is enabled, memory volumes aren't checked for purgable - * blocks. If the rover block isn't suitable, a new empty volume is created - * without further checking. This is suitable for cases where lots of blocks - * are being allocated in a rapid sequence, with no frees in between (e.g., - * map setup). - * * @par Block Sequences * The PU_MAPSTATIC purge tag has a special purpose. * It works like PU_MAP so that it is purged on a per map basis, but @@ -101,16 +95,6 @@ typedef struct zblockset_block_s { static memvolume_t *volumeRoot; static memvolume_t *volumeLast; -/** - * If false, Z_Malloc will free purgable blocks and aggressively look for - * free memory blocks inside each memory volume before creating new volumes. - * This leads to slower mallocing performance, but reduces memory fragmentation - * as free and purgable blocks are utilized within the volumes. Fast mode is - * enabled during map setup because a large number of mallocs will occur - * during setup. - */ -static boolean fastMalloc = false; - static mutex_t zoneMutex = 0; static __inline void lockZone(void) @@ -139,22 +123,6 @@ long superatol(char *s) return val; } -/** - * Enables or disables fast malloc mode. Enable for added performance during - * map setup. Disable fast mode during other times to save memory and reduce - * fragmentation. - * - * @param isEnabled true or false. - */ -void Z_EnableFastMalloc(boolean isEnabled) -{ - lockZone(); - - fastMalloc = isEnabled; - - unlockZone(); -} - /** * Create a new memory volume. The new volume is added to the list of * memory volumes. @@ -412,6 +380,11 @@ static __inline boolean isVolumeTooFull(memvolume_t* vol) return vol->allocatedBytes > vol->size * .95f; } +/** + * The static rovers should be rewound back near the beginning of the volume + * periodically. Currently this is done whenever tag ranges are purged (e.g., + * before map changes). + */ static void rewindStaticRovers(void) { memvolume_t* volume; @@ -513,18 +486,6 @@ void *Z_Malloc(size_t size, int tag, void *user) gotoNextVolume = false; - /* - if(fastMalloc) - { - // In fast malloc mode, if the rover block isn't large enough, - // just give up and move to the next volume right away. - if(base->user || base->size < size) - { - gotoNextVolume = true; - } - } - */ - numChecked = 0; // 'base' is the block that we'll end up using. diff --git a/doomsday/engine/portable/src/r_world.c b/doomsday/engine/portable/src/r_world.c index 5d5098368e..dadf8ff907 100644 --- a/doomsday/engine/portable/src/r_world.c +++ b/doomsday/engine/portable/src/r_world.c @@ -1355,12 +1355,6 @@ void R_SetupMap(int mode, int flags) switch(mode) { case DDSMM_INITIALIZE: - // Switch to fast malloc mode in the zone. This is intended for large - // numbers of mallocs with no frees in between. - /// @todo Fast mallocs are broken; they end up reserving more and more - /// new volumes as the old ones get "dirty". - Z_EnableFastMalloc(false /*true*/); - #ifdef _DEBUG Con_Message("R_SetupMap: ddMapSetup begins (fast mallocs).\n"); #endif @@ -1475,10 +1469,6 @@ void R_SetupMap(int mode, int flags) // Inform the timing system to suspend the starting of the clock. firstFrameAfterLoad = true; - // Switch back to normal malloc mode in the zone. Z_Malloc will look - // for free blocks in the entire zone and purge purgable blocks. - Z_EnableFastMalloc(false); - Z_PrintStatus(); return; }