我有一個相當複雜的多線程應用程序(服務器)不時會崩潰由於斷言:shared_ptr的斷言PX = 0失敗
/usr/include/boost/smart_ptr/shared_ptr.hpp:418: T* boost::shared_ptr< <template-parameter-1-1> >::operator->() const [with T = msg::Player]: Assertion `px != 0' failed.
我一直無法查明原因,是想知道這是一個問題與boost :: shared_ptr或它是我?
我試過g ++ 4.4.3-4ubuntu5和llvm-g ++(GCC)4.2.1,並且沒有優化和優化,libboost1.40-dev(= 1.40.0-4ubuntu4)。
多線程錯誤很難查明。既然你在linux上,沒有理由不使用valgrind--它會幫助你很大程度地發現錯誤。 – nos 2010-08-22 12:00:31
我正在廣泛使用valgrind,並且在斷言發生之前我得到了零錯誤(使用memcheck)。我仍然在學習如何解釋drd錯誤消息,因爲它們中的大多數(布爾型/整型類型的衝突加載/存儲)似乎不是問題。 – Horacio 2010-08-22 22:07:16