在测试 C 编程项目时,我遇到了这个错误:
realloc(): invalid pointer
我试图使用Valgrind找到问题的原因。当我在 Valgrind 中运行代码时,它在我的代码的不同部分陷入了无限循环,并且它没有检测到无效指针,所以我没有得到我正在寻找的答案。
我想我想知道的是:有其他人遇到过 Valgrind 的这个问题吗?出了什么问题?为什么 Valgrind 会跳入这个无限循环,但是当我自己运行代码时,我却得到了错误。
GDB 确实检测到了错误,但它给我的信息不足以修复错误;这就是为什么我想解决我在 Valgrind 中遇到的这个问题。