In some cases, my app takes a ridiculous amount of time to quit, with the time being spent in ArrayMemoryManager::defragment
as nodes are destroyed. Obviously, if I'm quitting, I don't care how fragmented memory is, so how can I avoid this?
Any way to avoid defragment delay?
-
- Goblin
- Posts: 224
- Joined: Thu Aug 12, 2021 10:06 pm
- Location: San Diego, CA, USA
- x 17
- Contact:
Any way to avoid defragment delay?
-
- Goblin
- Posts: 224
- Joined: Thu Aug 12, 2021 10:06 pm
- Location: San Diego, CA, USA
- x 17
- Contact:
Re: Any way to avoid defragment delay?
In my own fork of Ogre, I came up with a workaround. I added 2 new methods,
Code: Select all
void ArrayMemoryManager::neverDefragment()
{
mCleanupThreshold = std::numeric_limits<size_t>::max();
}
and
Code: Select all
void NodeMemoryManager::neverDefragment()
{
ArrayMemoryManagerVec::iterator itor = mMemoryManagers.begin();
ArrayMemoryManagerVec::iterator endt = mMemoryManagers.end();
while( itor != endt )
{
itor->neverDefragment();
++itor;
}
}
and in SceneManager::~SceneManager
, I added
Code: Select all
for( size_t i = 0; i < NUM_SCENE_MEMORY_MANAGER_TYPES; ++i )
{
mNodeMemoryManager[i].neverDefragment();
}
just before the clearScene
call. Seem to do the trick.
- dark_sylinc
- OGRE Team Member
- Posts: 5296
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1278
- Contact:
Re: Any way to avoid defragment delay?
I've been waiting for years for someone to come up asking about this! It seems no one was bothered, or noticed?
Could you submit a PR? This is definitely welcomed.
-
- Goblin
- Posts: 224
- Joined: Thu Aug 12, 2021 10:06 pm
- Location: San Diego, CA, USA
- x 17
- Contact:
Re: Any way to avoid defragment delay?
You got it, PR #281.