Bug 313598

Summary: KWindowSystem leaks memory
Product: [Unmaintained] kdelibs Reporter: Alex Richardson <arichardson.kde>
Component: kdeuiAssignee: kdelibs bugs <kdelibs-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: christoph
Priority: NOR    
Version First Reported In: 4.9.97 RC2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Alex Richardson 2013-01-21 00:30:21 UTC
Valgrind reports that KWindowSystem leaks memory:

 ==20597== 2,562 (104 direct, 2,458 indirect) bytes in 1 blocks are definitely lost in loss record 954 of 983
==20597==    at 0x4C2BC97: operator new(unsigned long) (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==20597==    by 0x65D5AC9: KWindowSystem::init(int) (kwindowsystem_x11.cpp:408)
==20597==    by 0x65D6029: KWindowSystem::compositingActive() (kwindowsystem_x11.cpp:797)
==20597==    by 0x1CB37E08: ??? (in /usr/lib64/libkonsoleprivate.so)
==20597==    by 0x400E7B5: call_init (in /lib64/ld-2.15.so)
==20597==    by 0x400E899: _dl_init (in /lib64/ld-2.15.so)
==20597==    by 0x4012A68: dl_open_worker (in /lib64/ld-2.15.so)
==20597==    by 0x400E5F5: _dl_catch_error (in /lib64/ld-2.15.so)
==20597==    by 0x401228B: _dl_open (in /lib64/ld-2.15.so)
==20597==    by 0xDFC7015: dlopen_doit (in /lib64/libdl-2.15.so)
==20597==    by 0x400E5F5: _dl_catch_error (in /lib64/ld-2.15.so)
==20597==    by 0xDFC75EB: _dlerror_run (in /lib64/libdl-2.15.so)


It seems to me that adding a destructor to KWindowSystemStaticContainer that deletes d would fix this issue, however I am very unfamiliar with that code, so I won't commit that change.
Not an important leak since it is a global static, but it would reduce valgrinds output
Comment 1 Christoph Cullmann 2024-05-10 22:16:26 UTC
Got fixed by using

std::unique_ptr<KWindowSystemPrivate> d;