Changing and fixing some stuff

- QHash is better to use than QMap in MemoryManager: faster lookups, able to reserve memory in advance
- Also: reserve memory in advance for the QVector and QHash, so we don't get needles allocs for them
- No need to do cleanup for the nph manager, as it uses the generic manager for allocs, and that already gets cleaned up
This commit is contained in:
Vesa
2014-08-24 13:38:48 +03:00
parent 42e67d27a1
commit 8fb8c683f9
5 changed files with 4 additions and 13 deletions

View File

@@ -37,6 +37,8 @@ QMutex MemoryManager::s_pointerMutex;
bool MemoryManager::init()
{
s_memoryPools.reserve( 64 );
s_pointerInfo.reserve( 4096 );
// construct first MemoryPool and allocate memory
MemoryPool m ( MM_INITIAL_CHUNKS );
m.m_pool = MemoryHelper::alignedMalloc( MM_INITIAL_CHUNKS * MM_CHUNK_SIZE );

View File

@@ -612,12 +612,3 @@ void NotePlayHandleManager::extend( int i )
}
s_mutex.unlock();
}
void NotePlayHandleManager::cleanup()
{
foreach( NotePlayHandle * n, s_nphCache )
{
delete n;
}
}

View File

@@ -538,7 +538,6 @@ int main( int argc, char * * argv )
// cleanup memory managers
MemoryManager::cleanup();
NotePlayHandleManager::cleanup();
return( ret );
}