[BUG?] Roughness cache (terrainname.info.cfg) file is HUGE.

Jerky

18-08-2006 01:59:19

The problem started with our map editor getting SUPER slow. We thought it was a recent update, so after we checked out the commits on that day, there was no sign of the problem. I checked into it, and our app was doubling its memory footprint each time is loaded. Since many of us experienced this around the same time, we thought it was some recent updates of ours, but that turned out to be a crazy coincidence (like 4 of us all on the same day).

It turned out that our terrainname.info.cfg file was 120MB. (I found out after trying to open it in notepad, boy was that a mistake ;) ). At that point, it takes the app over 3 minutes to load. After purging the file, our app began running perfectly again, but I decided to keep my eye on it. I searched to find out what the file was, since it seems to be a recent addition to our PLSM app. On first load, it starts at 15kb. The next load it goes to 30, then 60, then 120, 240, 480, 1mb, 2mb, and on and on and on. The growth is exponential (obviously).

Is that normal? Is there a way to have it delete itself after we exit the app, and do we want to do that? I read here that it is a cache, but what is it caching and do we need it?

Thanks in advance.

Jerky

18-08-2006 02:07:50

Well, deleting the file takes care of it, but do we need that file, or is it only meant for testing/debug?

I hope this helps someone who runs into the same problem. Just purging the file (deleting the contents, but not the file itself) only fixes it for a few loads.

Yellow

18-08-2006 15:20:32

The cache wasnt cleared when a new map was loaded, so the amount in cache would have doubled each time you loaded a new map and the cache file would double aswell...

fix:

added clearTileInfo() here:


void PagingLandScapeOptions::loadMap(const String& mapName)
{
std::vector<Ogre::String>::iterator itFileSystem = mResourceFilesystem.begin();
for(; itFileSystem != mResourceFilesystem.end(); ++itFileSystem)
{
ResourceGroupManager::getSingleton().removeResourceLocation(
*itFileSystem, groupName);
}
std::vector<Ogre::String>::iterator itZip = mResourceZip.begin();
for(; itZip != mResourceZip.end(); ++itZip)
{
ResourceGroupManager::getSingleton().removeResourceLocation(
*itZip, groupName);
}

// unload cached map info
clearTileInfo();

/* Set up the options For a Map*/
//ConfigFile config;
loadMapOptions (getMapFilename(mapName) + String(".cfg"));
}

tuan kuranes

21-08-2006 17:58:44

nice spot !
Committed in CVS, soon in next SDK.