Bug 337648 - simple creating document and closing Krita generating leak
Summary: simple creating document and closing Krita generating leak
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 2.9 Beta
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-21 02:50 UTC by Scott Petrovic
Modified: 2015-01-12 00:27 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Petrovic 2014-07-21 02:50:33 UTC
I am on Ubuntu 14.04 with Krita Lime (Pre-Alpha 2.9). I am starting Krita from the terminal (not sure if this matters though).

1. from terminal, type krita to launch
2. create custom document. Click create
3. Close Krita.

On close, the terminal is firing off some critical errors.

QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
CRITICAL: According to statistics of the KisTileDataStore some tiles have leaked from the Krita control! 
CRITICAL: Tiles in memory: 1 Total tiles: 1
Comment 1 Dmitry Kazakov 2014-07-30 11:14:55 UTC
Hi, Scott!

I've updated Krita Lime yesterday, could you please check whether the bug still persists. We did some fundamental changes in the tile storage and allocation since then and I guess I was fixing such bug then.

I will mark the bug as NEEDSINFO. If you still see the bug, please reopen the bug as UNCONFIRMED again.
Comment 2 Scott Petrovic 2014-07-31 03:17:16 UTC
hi Dmitri,

I switched to building from src to be slightly more up to date. I pulled the latest. the terminal is showing something slightly different now.

QCoreApplication::postEvent: Unexpected null receiver
QCoreApplication::postEvent: Unexpected null receiver
WARNING: trying to purge pool memory while there are used tiles present! 
         The memory will *NOT* be returned to the system, though it will 
         be reused by Krita internally. Please report to developers! 
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.
QGLContext::makeCurrent(): Cannot make invalid context current.

** (krita:21084): WARNING **: 1 dictionaries weren't free'd.


Not sure if that helps.
Comment 3 Halla Rempt 2014-08-23 12:11:23 UTC
I see this all the time, too. THe QGLContext warning is bogus, though.
Comment 4 Stefano Bonicatti 2014-12-06 20:52:34 UTC
Since the issue described here is very similar i'll report it here:
Using (current) latest version of Krita from git, opening and closing documents leaks memory.
In the link below (it's 14.7MB) there's a profile i did with valgrind, i've opened  and closed two times an exr image (32bitF, 4096x4096).
https://dl.dropboxusercontent.com/u/9553318/kritaopencloseleak.xml
Comment 5 Stefano Bonicatti 2014-12-07 18:46:16 UTC
I have addional informations about this problem:
1) A KoCanvasResourceManager is being created when Krita opens, then stuff added to it. 

2) When a document is opened a new KoCanvasResourceManager is created (due to the new view and the new canvas), and its underlying KoResourceManager receives 4 items. 

3) This new manager though is immediately deleted after that because the first KoCavasResourceManager is set as the shared one. 

4) Then the 4 items added to the second KoCanvasResourceManager now are added back to the shared one. 

5) When one closes the document though nothing is removed from the manager and this cycles continues everytime one closes and reopens images/documents, infact though debugging, one can see the manager having the underlying KoResourceManager QHash increase the number of items held each time a new document is opened.
This is one of the path i've found that holds shared pointers.. there may be others though.
Comment 6 Halla Rempt 2014-12-15 13:25:38 UTC
Ah! I wonder if that's fixed by DMitry's commit a2ccc43c8955498a33d9444451e181dbbb07fa1a
Comment 7 Stefano Bonicatti 2014-12-16 16:14:55 UTC
That one, according to Valgrind, seems to be fixed, there's another leak though that adds roughly 85MB opening and closing an image that (the first time it's opened), adds 200MB.
When Krita is closed it reports that tiles are leaked and Valgrind reports them, i'll try to see later if i can do something about it, otherwise i'll just add the report here.
Comment 8 Scott Petrovic 2015-01-12 00:27:36 UTC
I am not sure when it happened, but this bug got fixed at some point. I cannot reproduce this with the steps I originally outlined.

I am going to mark it as resolved.