In NDC.cpp, NDC object stored in TLS is not deleted on ending a thread, in the case LOG4CPP_USE_MSTHREADS is defined and MSThreads.hh is used.
(I don't know about the other options)
It results in increasing memory leaks by 1. start a thread, 2. use NDC, 3. end the thread, 4. start another thread, ...
In the case of Windows DLL, the end of the thread can be detected by DLL_THREAD_DETACH in DllMain().
See the attached patch.
Fix memory leak in NDC with MSThreads (Windows)