Valgrind的条件跳转或移动依赖于未初始化值(S),这并不表示内存泄漏? [英] valgrind Conditional jump or move depends on uninitialised value(s) , does this indicate memory leak?

查看:1438
本文介绍了Valgrind的条件跳转或移动依赖于未初始化值(S),这并不表示内存泄漏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对着在code内存泄漏问题,同时其运行,堆继续提高到最大,我需要重新启动该服务,我跑靠前指挥,并看到堆越来越大,每当即时调用在服务的情况。

I am facing a memory leak problem in the code, while its running, the heap goes on increasing to maximum and i need to restart the service, I ran top command and see that the heap is increasing whenever im invoking a scenario in the service.

我跑了Valgrind的服务,

I ran the service with valgrind ,

valgrind  --log-file=log-feb19.txt --leak-check=full --show-reachable=yes --track-origins=yes myservice

我DONOT看到任何肯定丢失或丢失的可能盖帽,IAM运行的情况,但我看到了很多条件跳转或移动的依赖于未初始化值(S)的错误。

I donot see any definitely lost or possibly lost blocks while iam running the scenarios but i see a lot of Conditional jump or move depends on uninitialised value(s) errors.

做这些计数的内存泄漏?

Do these count for a memory leak?

我所得到的示例:

==27278== Conditional jump or move depends on uninitialised value(s)

==27278==    at 0xC90D91E: xcsFreeMemFn (in /apps/opt/mqm/lib64/libmqmcs_r.so)

........

........

==27278==  Uninitialised value was created by a heap allocation

==27278==    at 0x4A078B8: malloc (vg_replace_malloc.c:270)

==27278==    by 0xC90E32F: xcsGetMemFn (in /apps/opt/mqm/lib64/libmqmcs_r.so)

可以有人帮忙。

推荐答案

没有,这意味着你正在访问尚未初始化的内存:

No, it means that you are accessing memory that hasn't been initialized:

int main()
{
     int unitialized;
     std::cout << unitialized << std::endl;
}

会引发此错误。

略较常见的是:

struct X 
{
     X() : i(42) { }
  private:
     int i;
     int* forgotten; // oops, not initialized
};

最后,这经常与基础的malloc code发生了,当你不使用 memset的来清除整个缓冲区。因此,

Lastly, this frequently happens with malloc based code, when you don't use memset to clear the whole buffer. So,


  1. malloc的一个缓冲区大小为m

  2. 阅读(例如,从插座)n字节

  3. 写字节数m到一个文件; (M-N)个字节不会被初始化

这篇关于Valgrind的条件跳转或移动依赖于未初始化值(S),这并不表示内存泄漏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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