Problems with boost 1.44.0 and MSVC: boost::mutex::scoped_lock and std::deque in multithreaded application

Greetings, ppl. I've got strange problems with the latest stable boost (1.44.0) and MSVS studios 2005 and 2010. The first problem I got (it seems being not dependent on boost version) was the heap allocation exception when using mutex::scoped_lock to guard references to std::deque from different threads in multithreaded application. I used MSVS SP1 compiler I checked it with boost 1.41.0 and it appeared there too, so it's not the bug of the latest version, for sure. I was not sure if it wasn't a bug of STL, but the strange thing was that if I used usual mutex lock/unlock functions instead of scoped_lock - it went just perfectly. That's why I decided to ask here, instead of blaming STL. I'm not sure if it's a bug to send it to a buglist. I'm far from being a newbie in multithreading programming, but I cannot guess where it comes from and I've got too little time to get deep into detailed boost debug. I've written a little test application that reveals the problem, I'm not sure if it's a good idea to insert the code right here, but I can send it on request. The second problem raised up when I tried to compile the same test application with MSVS 2010. I didn't use the MSVS 2010 for my application, but I decided to test if it was a problem with STL libs. That result was access violation in the boost::thread constructor. It goes well under MSVS 2005, though. And the constructor is ok when using MSVS 2010 with boost 1.41.0 too. I found some info in the internet that this bug appeared in boost 1.43.0, but was fixed. Bug I could not find it in bugs list of boost, so I decided to ask about it here. Meantime, the problem with heap allocation remained, with MSVS 2010 and boost 1.41.0. I'm not sure what to do with this issues. Maybe these are known problems? Sincerely, Yana.

2010/10/5 Yana A Kireyonok (aka Iron Bug)
Greetings, ppl. I've got strange problems with the latest stable boost (1.44.0) and MSVS studios 2005 and 2010.
The first problem I got (it seems being not dependent on boost version) was the heap allocation exception when using mutex::scoped_lock to guard references to std::deque from different threads in multithreaded application.
According to your description, it seems that the issue you encountered is only a symptom of some memory-management issue in your code: you've got a damaged heap at the point where scoped_lock tries to allocate memory. You can use MSVC heap debugging facilities to try and spot the problem: http://msdn.microsoft.com/en-us/library/974tc9t1.aspx . Besides, it worth checking that you never delete objects through a pointer to base-case (directly or using smart-ptrs), if they don't have virtual d-tor. This kind of bug ruins the heap immediately, but it's quite hard to locate it using the above heap-debugging techniques.

Greetings, ppl. I've got strange problems with the latest stable boost (1.44.0) and MSVS studios 2005 and 2010.
The first problem I got (it seems being not dependent on boost version) was the heap allocation exception when using mutex::scoped_lock to guard references to std::deque from different threads in multithreaded application.
Hi, You might want to check out this known bug with std::deque in MSVC. It's due to be fixed in VC11: https://connect.microsoft.com/VisualStudio/feedback/details/533131/bug-in-st... Regards, David.
participants (3)
-
David Ward
-
Igor R
-
Yana A Kireyonok (aka Iron Bug)