std::map insert core dumps

M

Mani

Hi ,
I am getting a crash in std::map insert. The map object is created, but
while inserting into it there is a core dump and this dosen't happen
frequently. The gdb trace looks like this.

_STL::_Rb_tree<long, _STL::pair<long const, int>,
_STL::_Select1st<_STL::pair<long const, int> >, _STL::less<long>,
_STL::allocator<_STL::pair<long const, int> > >::insert_unique
(this=0x81ac3e4, __v=@0xbfffc2e0) at _tree.h:265

I cannot paste the whole code, but please let me know if you have any clues.

Thanks,
Mani.
 
J

John Harrison

Mani said:
Hi ,
I am getting a crash in std::map insert. The map object is created, but
while inserting into it there is a core dump and this dosen't happen
frequently. The gdb trace looks like this.

_STL::_Rb_tree<long, _STL::pair<long const, int>,
_STL::_Select1st<_STL::pair<long const, int> >, _STL::less<long>,
_STL::allocator<_STL::pair<long const, int> > >::insert_unique
(this=0x81ac3e4, __v=@0xbfffc2e0) at _tree.h:265

I cannot paste the whole code, but please let me know if you have any clues.

Thanks,
Mani.

Yes you have a bug in your program. It's probably caused by memory or heap
corruption. It could have happened anywhere prior to the call to std::map
insert that fails. One thing to check for is that the classes that you are
inserting into the heap have correctly defined copy constructors and
assignment operators.

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,961
Messages
2,570,131
Members
46,689
Latest member
liammiller

Latest Threads

Top