Stephen Torri wrote:
On Fri, 2007-03-23 at 01:30 +0200, Peter Dimov wrote:
Stephen Torri wrote:
I am attempting to hunt down why I am getting a segmentation fault from the boost::shared_ptr class.
You could try #defining BOOST_SP_ENABLE_DEBUG_HOOKS and adding libs/smart_ptr/src/sp_debug_hooks.cpp to your project, which is a simple checker that tries to catch common problems.
You might also wish to verify that you aren't mixing single-threaded and multithreaded code or libraries in the same program.
As far as I know I have a single-threaded library I am creating. I put the BOOST_SP_ENABLE_DEBUG_HOOKS into the compile time flags for g++. I added the source file, sp_debug_hooks.cpp, into the build. I take it the checks are done when the library code is executed?
Yes, there are a bunch of assertions in sp_debug_hooks that attempt to catch heap- and shared_ptr-related errors. Make sure you don't #define NDEBUG, though. If the asserts don't trigger, your problem might be deeper than a simple invalid use of shared_ptr. If you post a backtrace/call stack of one of your crashes, we may be able to help.