Open Montel opened 3 months ago
That's not necessarily a leak in Qt.
While this means that the memory was allocated by Qt internally, the question is more why it wasn't deleted. This could be caused by our code not running the deconstructor of QPainterPath or doing some incorrect copy, etc.
We've encountered similar issues before, where certain types were not quite compatible with the way CXX moves data around. I think that was with QTimeZone, but I unfortunately can't find our discussion on that. I can recommend you try to run the test in a debugger and set breakpoints at the constructors and destructors of QPainterPath.
(gdb) c
Continuing.
Breakpoint 1.7, 0x00007ffff7911580 in QPainterPath::QPainterPath() () from /lib64/libQt6Gui.so.6
(gdb) c
Continuing.
Breakpoint 1.1, 0x0000000000418510 in QPainterPath::QPainterPath(QPainterPath const&)@plt ()
(gdb) c
Continuing.
Breakpoint 1.8, 0x00007ffff7911590 in QPainterPath::QPainterPath(QPainterPath const&) () from /lib64/libQt6Gui.so.6
(gdb) c
Continuing.
Breakpoint 2.1, 0x0000000000419680 in QPainterPath::~QPainterPath()@plt ()
(gdb) c
Continuing.
Breakpoint 2.3, 0x00007ffff7917a90 in QPainterPath::~QPainterPath() () from /lib64/libQt6Gui.so.6
(gdb) c
Continuing.
PASS : QPainterPathTest::construct()
Breakpoint 1.2, 0x0000000000418b40 in QPainterPath::QPainterPath()@plt ()
(gdb) c
Continuing.
Breakpoint 1.7, 0x00007ffff7911580 in QPainterPath::QPainterPath() () from /lib64/libQt6Gui.so.6
(gdb) c
Continuing.
Breakpoint 1.1, 0x0000000000418510 in QPainterPath::QPainterPath(QPainterPath const&)@plt ()
(gdb) c
Continuing.
Breakpoint 1.8, 0x00007ffff7911590 in QPainterPath::QPainterPath(QPainterPath const&) () from /lib64/libQt6Gui.so.6
(gdb) c
Continuing.
Breakpoint 1.1, 0x0000000000418510 in QPainterPath::QPainterPath(QPainterPath const&)@plt ()
(gdb) c
Continuing.
Breakpoint 1.8, 0x00007ffff7911590 in QPainterPath::QPainterPath(QPainterPath const&) () from /lib64/libQt6Gui.so.6
(gdb) c
Continuing.
Breakpoint 2.1, 0x0000000000419680 in QPainterPath::~QPainterPath()@plt ()
(gdb) c
Continuing.
Breakpoint 2.3, 0x00007ffff7917a90 in QPainterPath::~QPainterPath() () from /lib64/libQt6Gui.so.6
(gdb) c
Continuing.
Breakpoint 2.1, 0x0000000000419680 in QPainterPath::~QPainterPath()@plt ()
(gdb) c
Continuing.
Breakpoint 2.3, 0x00007ffff7917a90 in QPainterPath::~QPainterPath() () from /lib64/libQt6Gui.so.6
(gdb) c
Continuing.
PASS : QPainterPathTest::clone()
PASS : QPainterPathTest::cleanupTestCase()
Totals: 4 passed, 0 failed, 0 skipped, 0 blacklisted, 14776ms
So it seems there are indeed more constructor (9) than destructor (6) calls.
That's likely caused by CXX "forgetting" an instance, which we've encountered before. You may need to debug this further or try to just make QPainterPath an opaque type.
For me it's a mem leak in qt no ?