Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vector and deque initialization or push_back causes SIGABRT error

I'm getting a weird error, when initializing my deque or vector. I'm using QtCreator and a CMake-Project.

If I use a deque, it aborts on initialization:

std::deque<int> myValues; // <-- abort here

for (int i=0;i<10;++i)
{
    myValues.push_back(i);
}

when I use deque, it aborts on push_back:

std::vector<int> myValues; 

for (int i=0;i<10;++i)
{
    myValues.push_back(i); // <-- abort here
}

I can't find out why this is happening now (it worked that way all the time). Both aborts happen inside _gnu_cxx::new_allocator< int >::allocate.

Any hints?

Thanks for the effort in advance!

Hartmut

like image 843
hardmooth Avatar asked Aug 09 '26 19:08

hardmooth


1 Answers

It looks like a heap corruption in some other place in your program. That is, you write out-of-bounds or delete an invalid pointer somewhere. Once the heap internal structure is corrupted, substantial allocations may crash your program.

like image 156
Yakov Galka Avatar answered Aug 11 '26 10:08

Yakov Galka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!