0
我在我的代码,一个奇怪的分段错误,其使用下面的数据结构:STL集合内部地图,怪异赛格故障和Valgrind的分析
map< uint64_t, set<uint64_t> > _key_to_block;
Valgrind的的_key_to_block.erase(it)
抱怨此消息:
Address 0x6106118 is 56 bytes inside a block of size 88 free'd
用于从地图擦除元素,如下所示:
map< uint64_t, set<uint64_t> >::iterator it = _key_to_block.find(key);
(it->second).clear();
_key_to_block.erase(it);
此外,Valgrind也compl与此按摩的(it->second).insert(k);
AINS:
Invalid read of size 8
像这样在STL组插入元件:
map< uint64_t, set<uint64_t> >::iterator it = _key_to_block.find(key);
(it->second).insert(value);
然而,它并没有抱怨这一行的:
setit = it->second.find(value);
不限想法?
你确定你的地图存在'_key_to_block'吗?而且你没有在某个地方破坏它的记忆?你可以发布你的测试用具吗? – 2013-02-11 00:37:33