内存泄漏
==94164== Invalid free() / delete / delete[] / realloc()
==94164== at 0x4C3B02D: operator deletehttps://ask.csdn.net/void* (vg_replace_malloc.c:1103)
==94164== by 0x4012F6: PlayerList::PlayerList() (in /homes/zzhanggl/pa1.exe)PlayerList() (in /homes/zzhanggl/pa1.exe)
==94164== by 0x400F35: main (in /homes/zzhanggl/pa1.exe)
==94164== Address 0x5b4e550 is 0 bytes inside a block of size 80 free'd
==94164== at 0x4C3B02D: operator deletehttps://ask.csdn.net/void* (vg_replace_malloc.c:1103)
==94164== by 0x4012F6: PlayerList::
==94164== by 0x4019B5: Swiss::~Swiss() (in /homes/zzhanggl/pa1.exe)
==94164== by 0x400F29: main (in /homes/zzhanggl/pa1.exe)
==94164== Block was alloc'd at
==94164== at 0x4C38B6F: operator new[](unsigned long) (vg_replace_malloc.c:640)
==94164== by 0x401249: PlayerList::PlayerList() (in /homes/zzhanggl/pa1.exe)
==94164== by 0x400D8C: main (in /homes/zzhanggl/pa1.exe)
这到底是什么意思呢
哥哥,这段错误信息表示在 C++ 代码中存在内存泄漏和非法释放内存的问题:
new
运算符分配了一块大小为 80 字节的内存,但在程序结束时没有及时释放这块内存,因此导致了内存泄漏。解决这些问题的方法如下:
请注意,C++ 中的内存管理非常重要,需要特别注意避免内存泄漏和非法释放内存等问题,以确保程序的稳定性和可靠性。
Swiss::~Swiss()
PlayerList::PlayerList()
这些的代码呢
释放对象没有释放正确吧