Programming Tips - Borland C++ 5.02: std::string is leaking handles. How can I stop this?

Date: 2006Apr22 Keywords: obsolete, correction Product: Borland C++ 5.02 Language: C/C++ Q. Borland C++ 5.02: std::string is leaking handles. How can I stop this? A. Its not freeing up the string's mutex when the string is freed. Make these changes in C:\BC5\include ... In stdmutex.h, rename destructor of ~RWSTDMutex() to destroy() and make a new ~RWSTDMutex() which just calls destroy. In string.h line 1253, add a call to mutex_.destroy() ...
template <class charT, class traits, class Allocator > inline void string_ref<charT, traits, Allocator>::unLink(Allocator& alloc) { if (removeReference() == 0) { // begin dave fix #ifdef RWSTD_MULTI_THREAD mutex_.destroy(); #endif // end dave fix alloc.deallocate((charT*)this); } }
Note that even after this fix, a mutex is allocated for each std::string which seems excessive to me.