Commit 7e19ab8
fix: memory leak when overwriting cached DBus property values
In internalPropGet, QMetaType::construct is called on propertyPtr to copy
the latest value from a DBus reply, but the old object at that address is
never destructed. When the property type contains heap-allocated members
(such as QByteArray pixels inside DBusImageList), this leak accumulates
on every property read from the StatusNotifierItem interface (iconPixmap,
attentionIconPixmap, overlayIconPixmap, ToolTip etc.).
Add destruct before construct to properly release the previous value.
This reduces application-tray RSS growth from ~23 KB/s to ~3 KB/s.
internalPropGet 中每次 DBus 属性读取都通过 QMetaType::construct 将新值
原地复制到 propertyPtr,但旧对象未析构。对于包含堆内存成员的类型(如
DBusImageList 中的 QByteArray pixels),每次读取均导致旧数据泄漏。在
construct 前添加 destruct 释放旧值,application-tray 进程 RSS 增长从
约 23 KB/s 降至约 3 KB/s。
Log: fix: memory leak when overwriting cached DBus property values
Pms: BUG-359161
Change-Id: I80a2ed404b87bb87ce66fb3361ff7eb640b6c9fb1 parent 54fab04 commit 7e19ab8
1 file changed
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
180 | 180 | | |
181 | 181 | | |
182 | 182 | | |
| 183 | + | |
183 | 184 | | |
184 | 185 | | |
| 186 | + | |
185 | 187 | | |
186 | 188 | | |
187 | 189 | | |
| |||
0 commit comments