Releasing Critical Section
Posted on 2005-04-21
I have determined that my program does not release the Critical Section object when it exits>
It inits the critical section with InitializeCriticalSectionandSpinLock(m_CS, 250);
Then, I should really be calling DeleteCriticalSection(m_CS);, but I am not. When the program exists, will the Critical Section resource be returned to windows or not?
I mean, when you allocate memory and not release it, Windows OS will release memory for you. Will it release the resource as well? I know for a fact that a GDI resource will NOT be released. But what about the Critical Section?
I am having a deadlock possibility which I can not reproduce, but if I exhausted all of my critical section resources, that could explain why this deadlock occures.
Any help would be appreciated.