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

戏子无情 提交于 2019-12-23 09:19:23

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/36028302/valgrind-reporting-brk-segment-overflow-in-thread-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!