Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valgrind reporting "brk segment overflow in thread #1" [duplicate]

Tags:

c++

valgrind

I wonder what this message implies:

==18151== brk segment overflow in thread #1: can't grow to 0x4a26000

Note that the code runs just fine and the output is correct. Should I just ignore this message? And what does it mean?

like image 426
user3639557 Avatar asked Mar 16 '16 06:03

user3639557


1 Answers

I think you can ignore it. I got the message in a new allocation in some code that seemed to work perfectly and I also get the message it in the following code:

#include <vector>

struct Something
{
    Something() : a1(0), b1(0) { }
    unsigned short a1;
    unsigned short b1;
};

const int allocsize = 10000;

struct Tester
{
   Tester()
   {
       for (int u = 0; u < allocsize; ++u)
           data.push_back(new Something[519]);
   }

   ~Tester()
   {
       for (int u = 0; u < allocsize; ++u)
           delete[] (data[u]);
   }

   std::vector<Something*> data;
};

void test()
{
     Tester t;
     // while (true) {;}
}

int main()
{
    test();
    return 0; 
}

I also noticed that others experience the same issue:

Valgrind reporting a segment overflow

like image 196
Thorbjørn Martsum Avatar answered Sep 28 '22 18:09

Thorbjørn Martsum