valgrind显示没有任何堆分配的代码的堆分配

时间:2018-08-15 23:23:34

标签: c++ valgrind

Valgrind显示以下示例代码的堆内存分配,

#include <stdio.h>

int main() {
  int a = 7;
  printf("%d", a);
  return 0;
}

摘要报告是

==1825== HEAP SUMMARY:
==1825==     in use at exit: 0 bytes in 0 blocks
==1825==   total heap usage: 1 allocs, 1 frees, 1,024 bytes allocated
==1825==
==1825== All heap blocks were freed -- no leaks are possible
==1825==
==1825== For counts of detected and suppressed errors, rerun with: -v
==1825== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

示例代码没有任何堆内存分配。

有人可以解释为什么会在这里发生吗? 预先感谢.....

0 个答案:

没有答案