Boost.Thread throws bad_alloc exception in VS2010?

This was by de See this thread for the details.

This sounds like a mismatch between the Boost static libraries and the header files. How did you install boost? Did you run the bootstrap.

Bat on the machine to build it? Did you modify the boost header files after compilation? Do you have a library directory reference in the VS 2008 global settings to a directory containing a different version of the boost libraries?

Put another way, have you tried a clean install of boost with the libraries compiled with bootstrap. Bat and have you deleted all other boost implementations on your machine? Until you've done that, you're working on a less-than-solid foundation.

If you still have trouble after that, have you tried going to Debug->Exceptions and turning on breaking on first-chance C++ and Win32 exceptions so that you can see the call stack in the debugger? If that doesn't work, have you tried using the Win32 API SetUnhandledExceptionFilter(), passing in a callback that uses the MiniDumpWriteDump() API of DBGHELP. DLL to write out a mini-dump (*.

Dmp) of the process to a file that you can then post-mortem debug using the VS 2010 debugger?

I don't know those functions. Got any links to explain how this is done. I got the libraries from a friend who compiled them on an exact machine but tried recompiling.It doesn't help – the_drow Jun 4 '10 at 18:25 MiniDumpWriteDump: msdn.microsoft.

Com/en-us/library/ms680360(VS.85). Aspx, debuginfo.Com/examples/effmdmpexamples. Html SetUnhandledExceptionFilter: msdn.microsoft.

Com/en-us/library/ms680634(VS.85). Aspx, debuginfo. Com/articles/debugfilters.

Html – David Gladfelter Jun 4 '10 at 18:41 I wonder if the 'accepted' answer actually worked for the poster. I'm currently experiencing the same problem and I would appreciate some help :) stackoverflow. Com/questions/3428177/… – StackedCrooked Aug 6 '10 at 23:06.

I recommend trying to create a new, empty, Win32 Console Application (I usually check the "Empty Project" checkbox as well so as not to get precompiled headers and such for small projects). Add a . Cpp file to the project and give it your contents.In the project properties, under C/C++ -> General, in the Additional Include Directories box, add the path to your top-level Boost folder (the one that contains the folder named boost that has all the header files).

In my case, it's z:\dev\boost_1_43_0; based on your post, yours is probably I:\SophisPal\boost-1_43_0-vc10-32\include\boost-1_43. Also in the project properties, under Linker -> General, in the Additional Library Directories box, add the path to the folder containing the compiled Boost libraries. On my PC, this is z:\dev\boost_1_43_0\lib; based on your post, yours is probably I:\SophisPal\boost-1_43_0-vc10-32\lib.

You don't need to explicitly tell the linker which libraries you want to link against; the Boost headers use one of the Visual C++ #pragma directives to tell the linker which libraries need to be used. With just that, you should be able to build and run both Debug and Release configurations. I went through exactly these steps on and had no issues.

If that works, I'd start modifying the project, one option at a time, until it matches your current project's configuration. Eventually something will make it stop working, then you'll know what the problem is. If that doesn't work, I'd look at downloading the Boost source and building it again.

Done that, and even tried to link to an older version of boost. Same exception. – the_drow May 30 '10 at 1:06 1 @the_drow: At that point, I'd consider trying on another machine or in a clean VM with the same source or uninstalling and reinstalling Visual Studio 2010.

I'm fresh out of other ideas, sorry :( – James McNellis May 30 '10 at 1:10.

I know because I see it happens AFTER my return 0. All I see is is some debug related memory code. How do I post the stack trace?

– the_drow Jun 3 '10 at 9:58 You tell VS to break on SEH exceptions, and when the debugger breaks upon the crash you can see the stack trace. Alternatively you can trigger a crash dump and then analyze the dump in WinDbg or VS. Dr. Watson is probably the default post-mortem debugger, and it does just that (you just have to grab the dump file before it deletes it).

– gigantt. Com Jun 4 '10 at 16:12.

You should use a memory profiler like VLD (Windows) or Valgrind (Linux) to check if it can point to the bad allocation, maybe you have a version of the Boost library that contains an incompatibility bug with your current compiler and you might have to apply a fix.

You either have a bad build or messed up project settings since you've tried creating a new basic project and simply including the header I'd suggest recompiling boost. You can download the latest version 1.45 from sourceforge which is linked from boost.org. Grab the latest bjam while you're there.

You can run the following commands from your visual studio command prompt to build boost in 64bit and 32bit: bjam --build-type=complete --toolset=msvc-10.0 --stagedir=lib64 address-model=64 stage > x64-buildboost. Log RD bin. V2 /S /Q bjam --build-type=complete --toolset=msvc-10.0 --stagedir=lib32 stage > x86-buildboost.

Log RD bin. V2 /S /Q On a side note if the CSF reference refers to Intel's Communications Services Framework open source telephony project I worked on that before and upgrading boost with that project back in the day broke more things than it fixed ... fair warning.

This sounds like a mismatch between the Boost static libraries and the header files. How did you install boost? Did you run the bootstrap.

Bat on the machine to build it? Did you modify the boost header files after compilation? Do you have a library directory reference in the VS 2008 global settings to a directory containing a different version of the boost libraries?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions