*** glibc 检测到*** 双重释放或损坏(fasttop):

发布于 2024-08-20 08:45:53 字数 740 浏览 5 评论 0原文

对 QByteArray 进行清除的调用会生成以下异常:

* glibc detectors * /home/yan/FPS2/FPS2: double free or Corruption (fasttop):

0 ?? 1 ??
2 免费
3 QByteArray::clear()
4 FPSengine::getDatagrams
5 FPSengine::xmitData
6 FPSengine::getData
7 threadDatalog::r​​un
8 ??
9 启动线程
10 克隆
11 ?? 0

这是一个 qt bug 还是与我的代码有关?我知道 QObject 不是线程安全的(QT 定义不是多个线程调用同一对象实例的同一函数),但我的函数有互斥体。此外,即使经常调用相同的函数,我也很少遇到此错误。 PS 防​​止这种情况的方法是 env var MALLOC_CHECK_ 0

这个 url 涉及类似的问题,一些帖子似乎暗示它是由不兼容的 glibc 版本引起的。

*** glibc 检测到 *** perl:双重释放或损坏(!prev): 0x0c2b7138 ***

A call to clear on a QByteArray generates the following exception:

* glibc detected * /home/yan/FPS2/FPS2: double free or corruption (fasttop):

0 ??
1 ??
2 free
3 QByteArray::clear()
4 FPSengine::getDatagrams
5 FPSengine::xmitData
6 FPSengine::getData
7 threadDatalog::run
8 ??
9 start_thread
10 clone
11 ?? 0

is this a qt bug or could it have something to do with my code? I know QObjects arent thread safe (QT definition not multiple threads calling the same function of the same object instance)but my function has mutexes. Also I very rarely get this error even though the same function is called frequently. P.S. A way to prevent this is to env var MALLOC_CHECK_ 0

this url relates a similar problem and some posts seems to imply its caused by an incompatible version of glibc.

*** glibc detected *** perl: double free or corruption (!prev): 0x0c2b7138 ***

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

莳間冲淡了誓言ζ 2024-08-27 08:45:53

它可能是许多不同的事情,包括引用函数调用返回的临时 QByteArray,但它不太可能(IMO)是 Qt 中的错误。

以下是调试的一些想法:

  • 在 Valgrind 下运行它,看看它是否会突出显示问题;
  • 针对具有可用调试符号的 Qt 版本运行应用程序;
  • 启用核心转储,看看是否获得核心文件

It could be a number of different things, including referencing a temporary QByteArray returned by a function call, but it's unlikely (IMO) to be a bug in Qt.

Here's a few thoughts for debugging:

  • run it under Valgrind and see if it will highlight the problem
  • run your application against a version of Qt that has debug symbols available for it
  • enable core dumps and see if you get a core file
不即不离 2024-08-27 08:45:53

这是由于应用程序是多线程的,该对象属于主线程,但在另一个线程中使用,即使我在 QBytearray 上使用互斥体,使用它来执行 readDatagram 的 UDPsocket 也在主线程中......并且是的,我也需要 udpSocket 位于主线程中

this is caused by the fact the the application is multithreaded, the object belongs in the mainthread but is used in another thread, even though I used mutexes on the QBytearray the UDPsocket which uses it to do readDatagram is also in the mainthread...and yes I need that udpSocket to be in the main thread as well

丢了幸福的猪 2024-08-27 08:45:53

我非常怀疑你是否发现了 qt 中的错误。发生该错误的原因有多种,但最重要的是您拥有对已释放内存的引用。运行调试器并尝试查看导致问题的原因。使用 gdb 和 valgrind 希望你能找到问题所在。

I highly doubt you have found a bug in qt. That error can occur for a number of reasons, but essential means you have a reference to memory that has already been freed. Run through debuggers and try and see what is causing the problem. Use gdb and valgrind and hopefully you can track down the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文