【发布时间】:2010-04-28 00:07:04
【问题描述】:
我写了这段代码。它运行正常,但是当我在 Valgrind 下检查它时,它发现了 2 个问题。由于我无法解释 valgrind 的消息,如果有人向我解释并告诉我问题出在哪里,我将不胜感激!!!
代码如下:
#include <iostream>
#define width 70000
#define height 10000
using namespace std;
int main(void)
{
int** pint;
pint = new int*[height];
for(int i = 0; i < height; i++)
pint[i] = new int[width];
for(int i = 0; i < height; i++){
delete[] pint[i];
pint[i] = NULL;
}
delete[] pint;
pint = NULL;
return 1;
}
【问题讨论】:
-
valgrind 的抱怨是什么?
-
如果没有看到投诉,我们无法告诉您 valgrind 问题是什么。
-
也许发布 valgrind 消息 - 乍一看,这段代码看起来不错。
-
有大量的消息,我怎样才能在这里得到所有这些消息?你能在你的机器上运行代码吗...?
-
标签: c++ dynamic arrays 2d valgrind