小编fin*_*g83的帖子

堆腐败

如果我们在新数组和删除char数组之间有大量代码,为什么会出现问题.

void this_is_bad() /* You wouldn't believe how often this kind of code can be found */
{
  char *p = new char[5];    /* spend some cycles in the memory manager */
  /* do some stuff with p */
  delete[] p;      /* spend some more cycles, and create an opportunity for a leak */
}
Run Code Online (Sandbox Code Playgroud)

c++ heap corruption

1
推荐指数
2
解决办法
1711
查看次数

标签 统计

c++ ×1

corruption ×1

heap ×1