c++ - glibc 检测到双重释放或损坏

标签 c++ glibc

我遇到了 glibc 检测到的问题。我已经研究了解决这个问题的方法,但似乎正确的解决方案是释放我分配的任何内容。然而,即使我这样做了,我仍然会在输出屏幕上收到内存映射打印。

class TestDepth{
    gameStatus temp;
public:
    TestDepth(gameStatus &currentGameState)
    {
        temp = currentGameState;

        free(&temp);
    }
};

只有在放置 temp=currentGameState 行时才会出现此错误。但是一旦我评论出来,它就可以正常工作。

最佳答案

As you can see, I'm having a glibc detected problem. I have research a way to solve this however it seems like the correct solution is to free whatever I have allocated.

您没有分配任何东西。你不应该释放任何东西。

关于c++ - glibc 检测到双重释放或损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11173935/

相关文章:

C++ 新手尝试循环

java - 我可以在 Android 的 2 个 OpenGL 上下文之间共享外部纹理吗

c++ - 堆栈上的非静态大小的数组

python - 在 Ubuntu 12.04 中的 Python 2.7 中导入 Tensorflow 时出错。 'GLIBC_2.17 not found'

c++ - *** 检测到 glibc *** {二进制路径} : double free or corruption (out): 0x0000000000639310 ***

c - 频繁调用 isatty() 对性能的影响

c++ - 使用 __LINE__ 为不同的变量名创建宏

c++ - 写入文件在 Qt5/Qml 中不起作用

c - libc_nonshared.a 的用途是什么?

c - 当这些符号是 glibc 的一部分时,链接器会更改这些符号名称