Bug 486743 - Notifications leak memory
Summary: Notifications leak memory
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Notifications (show other bugs)
Version: 6.0.4
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Plasma Bugs List
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2024-05-07 16:57 UTC by Nate Graham
Modified: 2024-06-26 15:09 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2024-05-07 16:57:16 UTC
Current git master of everything KDE built from source on top of Fedora 40 KDE, with Qt 6.7.0 from distro packages.


STEPS TO REPRODUCE
1. Open System monitor, go to the Processes page, and search for "plasmashell"
2. In a terminal window, run `while true; do notify-send foo bar; done`


OBSERVED RESULT
plasmashell's memory usage slowly but continuously rises, and doesn't fall again after 5 minutes of not interacting with the system.


EXPECTED RESULT
Notifications that don't get stored in history don't permanently increase plasmashell's memory usage.


ADDITIONAL INFORMATION
In actual usage with notifications that include icons or pixmaps (e.g. from a chat client like NeoChat), the memory usage rises faster compared to using `notify-send` to spam notifications
Comment 1 Kai Uwe Broulik 2024-05-07 21:19:10 UTC
I had a quick look with hotspot and it seems like there’s a leak in QRhi somewhere. Seems every window gets its own RHI instance with its own glyph cache which is then leaked. Alas, I haven’t managed to figure out where it comes from or what the remedy would be, or if that’s even the case, or why it only really shows with notifications (I doubt it’s only notifications but they create a new window every time).

for reference the leak stack in heaptrack:
2,7MB (33.2%) contribution to peak consumption in QRhi::nextResourceUpdateBatch() in libQt6Gui.so.6 and below.
2,7MB (33.2%) contribution to peak consumption in QSGDefaultRenderContext::glyphCacheResourceUpdates() in libQt6Quick.so.6 and below.
2,7MB (33.2%) contribution to peak consumption in QSGRhiTextureGlyphCache::createEmptyTexture(QRhiTexture::Format) in libQt6Quick.so.6 and below.
2,7MB (33.2%) contribution to peak consumption in QSGRhiTextureGlyphCache::endFillTexture() in libQt6Quick.so.6 and below.
2,8MB (34.5%) contribution to peak consumption in QTextureGlyphCache::fillInPendingGlyphs() in libQt6Gui.so.6 and below.
2,8MB (34.9%) contribution to peak consumption in QSGTextMaskMaterial::populate(QPointF const&, QList<unsigned int> const&, QList<QPointF> const&, QSGGeometry*, QRectF*, QPointF*, QMargins const&) in libQt6Quick.so.6 and below.
2,8MB (35%) contribution to peak consumption in QSGDefaultGlyphNode::update() in libQt6Quick.so.6 and below.
2,8MB (35.1%) contribution to peak consumption in QSGInternalTextNode::addGlyphs(QPointF const&, QGlyphRun const&, QColor const&, QQuickText::TextStyle, QColor const&, QSGNode*) in libQt6Quick.so.6 and below.
2,8MB (35.1%) contribution to peak consumption in QQuickTextNodeEngine::addToSceneGraph(QSGInternalTextNode*, QQuickText::TextStyle, QColor const&) in libQt6Quick.so.6 and below.
2,8MB (35.1%) contribution to peak consumption in QSGInternalTextNode::doAddTextLayout(QPointF, QTextLayout*, int, int, int, int) in libQt6Quick.so.6 and below.
2,8MB (35.1%) contribution to peak consumption in QSGTextNode::addTextLayout(QPointF, QTextLayout*, int, int, int, int) in libQt6Quick.so.6 and below.
2,9MB (35.6%) contribution to peak consumption in QQuickText::updatePaintNode(QSGNode*, QQuickItem::UpdatePaintNodeData*) in libQt6Quick.so.6 and below.
3,0MB (37.5%) contribution to peak consumption in QQuickWindowPrivate::updateDirtyNode(QQuickItem*) in libQt6Quick.so.6 and below.
3,0MB (37.6%) contribution to peak consumption in QQuickWindowPrivate::updateDirtyNodes() in libQt6Quick.so.6 and below.
3,1MB (38%) contribution to peak consumption in QQuickWindowPrivate::syncSceneGraph() in libQt6Quick.so.6 and below.
3,1MB (38%) contribution to peak consumption in QSGRenderThread::sync(bool) in libQt6Quick.so.6 and below.
5,6MB (69.6%) contribution to peak consumption in QSGRenderThread::syncAndRender() in libQt6Quick.so.6 and below.
7,1MB (88.2%) contribution to peak consumption in QSGRenderThread::run() in libQt6Quick.so.6 and below.
7,1MB (88.2%) contribution to peak consumption in terminate_on_exception<QThreadPrivate::start(void*)::<lambda()> >::operator() in libQt6Core.so.6 and below.
Comment 2 Arjen Hiemstra 2024-06-26 08:19:26 UTC
Git commit 9ed348547fadf64fe007ebc065f689154378d09a by Arjen Hiemstra.
Committed on 26/06/2024 at 08:16.
Pushed by ahiemstra into branch 'master'.

quick/dialogbackground: Ensure we delete the SVG item

It is rather unclear how ownership is here and when the SVG is deleted.
So make sure to request deletion if the background object is deleted.

M  +1    -0    src/plasmaquick/dialogbackground_p.cpp

https://invent.kde.org/plasma/libplasma/-/commit/9ed348547fadf64fe007ebc065f689154378d09a
Comment 3 Arjen Hiemstra 2024-06-26 08:22:48 UTC
Git commit 7d875a8080445fc72c6eec8da5065556c1a89ac1 by Arjen Hiemstra.
Committed on 26/06/2024 at 08:20.
Pushed by ahiemstra into branch 'Plasma/6.1'.

quick/dialogbackground: Ensure we delete the SVG item

It is rather unclear how ownership is here and when the SVG is deleted.
So make sure to request deletion if the background object is deleted.


(cherry picked from commit 9ed348547fadf64fe007ebc065f689154378d09a)

Co-authored-by: Arjen Hiemstra <ahiemstra@heimr.nl>

M  +1    -0    src/plasmaquick/private/dialogbackground_p.cpp

https://invent.kde.org/plasma/libplasma/-/commit/7d875a8080445fc72c6eec8da5065556c1a89ac1