Fix memory leak due to batchRayCast never deleting the btTaskScheduler.

(and issue with TaskScheduler/btTaskScheduler.cpp, add JobQueue::exit, call it first, since it uses the m_threadSupport which was deleted before the destrucor was called.
Use a hashmap to store user timers, to avoid allocating many identical strings.
This commit is contained in:
erwincoumans
2018-06-16 09:37:53 -07:00
parent cb1fce7899
commit 04d03d10be
6 changed files with 77 additions and 17 deletions

View File

@@ -209,13 +209,19 @@ public:
}
~JobQueue()
{
freeJobMem();
exit();
}
void exit()
{
freeJobMem();
if (m_queueLock && m_threadSupport)
{
m_threadSupport->deleteCriticalSection(m_queueLock);
m_queueLock = NULL;
m_threadSupport = 0;
}
}
}
void init(btThreadSupportInterface* threadSup, btAlignedObjectArray<JobQueue>* contextArray)
{
m_threadSupport = threadSup;
@@ -448,6 +454,12 @@ public:
virtual ~btTaskSchedulerDefault()
{
waitForWorkersToSleep();
for ( int i = 0; i < m_jobQueues.size(); ++i )
{
m_jobQueues[i].exit();
}
if (m_threadSupport)
{
delete m_threadSupport;