Valgrind 报告“线程 #1 中的 brk 段溢出"; [英] Valgrind reporting "brk segment overflow in thread #1"

查看:37
本文介绍了Valgrind 报告“线程 #1 中的 brk 段溢出";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道这条消息意味着什么:

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?

推荐答案

我认为你可以忽略它.我在一些似乎完美运行的代码中的新分配中收到了消息,我也在以下代码中收到了消息:

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 报告段溢出

这篇关于Valgrind 报告“线程 #1 中的 brk 段溢出";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆