fix: memory leak when overwriting cached DBus property values#562
Open
yixinshark wants to merge 1 commit intolinuxdeepin:masterfrom
Open
fix: memory leak when overwriting cached DBus property values#562yixinshark wants to merge 1 commit intolinuxdeepin:masterfrom
yixinshark wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
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: I80a2ed404b87bb87ce66fb3361ff7eb640b6c9fb
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: I80a2ed404b87bb87ce66fb3361ff7eb640b6c9fb