Bug 380270 - [Memory Leak] - From taskmanager when dragging an image from Spectacle
Summary: [Memory Leak] - From taskmanager when dragging an image from Spectacle
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Task Manager and Icons-Only Task Manager (show other bugs)
Version: 5.9.5
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-28 09:27 UTC by Michail Vourlakos
Modified: 2017-05-31 09:08 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
high memory from taskmanager (572.59 KB, image/png)
2017-05-29 16:06 UTC, Michail Vourlakos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michail Vourlakos 2017-05-28 09:27:56 UTC
This is probably a spectacle issue but it is very important as it increases plasma memory endlessly

Steps to reproduce:
1. The user drags the screenshot from spectacle onto the plasma taskmanager
2. the user doesnt release the image, he just moves the mouse over the taskmanager with the dragged image
3. Observing through ksysguard the plasmashell app its memory increases endlessly and it is not released afterwards
Comment 1 Kai Uwe Broulik 2017-05-29 12:03:25 UTC
When I do this (only tried with Task Manager in plasmoidviewer, though) Spectacle crashes after hovering the fourth or fifth icon by having its X connection die.
Comment 2 Michail Vourlakos 2017-05-29 16:05:33 UTC
In my system even with plasmawindowed (I think plasmoidviewer is a plasma 4 thing) I get the same behavior
Comment 3 Kai Uwe Broulik 2017-05-29 16:06:24 UTC
Plasmoidviewer is in plasma-sdk
Comment 4 Michail Vourlakos 2017-05-29 16:06:24 UTC
Created attachment 105755 [details]
high memory from taskmanager
Comment 5 Michail Vourlakos 2017-05-29 16:08:38 UTC
the issue has been confirmed also from other users because it appeared first in Latte and we tracked it down also to plasma taskmanager. This means that it can be either from libtaskmanager or libtaskmanagerbackend that Latte uses also or from taskmanager implementation that Latte follows in many parts.
Comment 6 Michail Vourlakos 2017-05-29 16:09:17 UTC
(In reply to Kai Uwe Broulik from comment #3)
> Plasmoidviewer is in plasma-sdk

nice, I didnt know that
Comment 7 David Edmundson 2017-05-29 17:28:24 UTC
DeclarativeMimeData* DeclarativeDragDropEvent::mimeData() definitely has a bug.

In theory as the object is created from an invokable from QML it gets QML ownership, which means the JS intepretter will delete it.

But if that's the case, we shouldn't be tracking it blindly as a member var, because potentially that's a dangly pointer.

or it's not getting QML ownership, and then it's just leaking like crazy, which would be unexpected to me, but it'd match this bug report.
Comment 8 David Edmundson 2017-05-29 17:30:43 UTC
Edit:

realised something just after I hit save changes.

"This applies only to explicit invocations of Q_INVOKABLE methods or slots, but not to property getter invocations."

and this is a property, hence leaking.

We can either delete when the event is deleted or use JS ownership.
Comment 9 Kai Uwe Broulik 2017-05-29 17:31:57 UTC
> In theory as the object is created from an invokable from QML

It's exposed as a property, so this doesn't apply, instead we get

> or it's not getting QML ownership, and then it's just leaking like crazy,
Comment 10 David Edmundson 2017-05-31 09:08:48 UTC
Git commit 695f24fb522a5ae6fe2530cbd72d3966b234b025 by David Edmundson.
Committed on 31/05/2017 at 09:08.
Pushed by davidedmundson into branch 'master'.

Don't leak MimeData object

Summary:
A DeclarativeDropArea creates a new DeclarativeDragDropEvent on every
enter/move/leave event.

The getter method for the mimeData property creates a new MimeData
QObject wrapper, which then leaks.

Use of the mimeData object outside of the event shouldn't be expected to
work, and a quick grep couldn't find any usage.

Test Plan: Dragged some things

Reviewers: #plasma, mart, hein

Reviewed By: #plasma, mart, hein

Subscribers: hein, plasma-devel, #frameworks

Tags: #plasma, #frameworks

Differential Revision: https://phabricator.kde.org/D6017

M  +2    -2    src/qmlcontrols/draganddrop/DeclarativeDragDropEvent.cpp
M  +2    -3    src/qmlcontrols/draganddrop/DeclarativeDragDropEvent.h

https://commits.kde.org/kdeclarative/695f24fb522a5ae6fe2530cbd72d3966b234b025