我收到运行时错误被释放的指针未被分配 - 如何调试?
malloc: *** error for object 0x10070c5c0: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
以下堆栈跟踪:
这告诉我,不顺心的事在析构函数~Clustering
和~NodeMap
(第一个是空的第二个调用delete[]
),但不是“正在释放的指针”所在的位置。我怎样才能找到这个?
另外,在哪里是malloc_error_break
?
在valgrind或任何此类内存泄漏/损坏检测工具下运行它。 –
阅读“[三条法则](http://stackoverflow.com/questions/4172722/what-is-the-rule-of-ree)”。 –
“*这告诉我在析构函数'〜Clustering'和'〜NodeMap'(它们是空的存根)*”中出错了。我不认为他们都是空的。我很确定'〜NodeMap()'调用'delete []'。 –