-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work around a huge memory leak in PySide on Python 3 #1323
Conversation
@cgohlke Will this make |
|
I don't know if we have a policy about this stuff -- but maybe what we should do is add a comment to this saying "this is a workaround for a bug in PySide 1.1.2 -- it should be removed when we don't need to support that version anymore", and maybe file an issue with a new label called "workarounds" -- and we periodically check those issues to see if it's time to remove them. |
OK, I'll add the comments. Can this issue be reproduced on MacOS or Linux? |
I would love to check I can reproduce the error on a mac but I can't for the life of me get PySide to build with python 3.2. I'm using pip inside a python3.2 virtual env and I'm getting an error saying it can't find the python shared library. Looks like pyside is only support on windows and linux with pip? Building a bdist_egg from the pyside git repository fails to initialise the git submodules so I get another failure. Perhaps someone with a linux machine can reproduce this memory leak issue. |
I've got it working with python2.7 using homebrew. I should get a chance to try it out this weekend given how miserable the weather is looking... |
As have I. Python 2.7 wasn't an issue. Python 3.x, on the other hand, is a nightmare. |
Any movement on this? I consider this critical for rc3. |
I got an off-list reply from David Honcik saying that the patch works for him (on Windows). |
In trying to confirm this on Linux, I'm noticing that I get an immediate segfault when using PySide 1.1.0 on Linux (with Python 2.7) both with and without this patch. I'm going to file a new issue for that. |
@efiring Do you have python 3.[23] installed? If so, can you recreate the memory issue here? |
FWIW: Now that I have #1404 resolved, I can't reproduce this leak on Linux PySide 1.1.0. Not sure why it's platform-specific. (It may be version specific, as the original reports are for PySide 1.1.1 and 1.1.2). I did, however, run this branch and it appears to have no ill effects. |
On 2012/10/16 8:24 AM, Damon McDougall wrote:
@dmcdougall No, I have not yet tried python 3.x on any machine, virtual |
@efiring I am jealous. I'd like to test this but I'd need to install |
Ok, I have spent about two days trying to get PySide to play with python3.2 on OS X and every attempt I have tried has failed. Unless anybody else can get this installed to actually test it on python3.2 I think this is a lost cause for Mac users. On python2.7, however I see no memory leak without @cgohlke's patch. With @cgohlke's patch, I see no adverse side-effects. I used pyside version 1.1.2. I think @mdboom's suggestion of opening a separate 'clean-up' issue is the way to go here. Just so we don't end up with lingering code that nobody is sure about. I give this a +1. What does everyone else think? |
On 2012/10/18 3:05 AM, Damon McDougall wrote:
Sounds fine to me. |
Merging, closing and opening a reminder issue for the future. Thanks. |
Work around a huge memory leak in PySide on Python 3
As reported by David Honcik on the matplotlib-users mailing list, there is a huge memory leak on Python 3 when using the Qt4Agg backend with PySide versions 1.1.1 and 1.1.2 (confirmed on Windows).
To reproduce, run the following script on Python 3.2 or 3.3 and observe the allocated process memory increase while resizing the main window:
The problem is that QImage increases, but never decreases, the reference count of the string buffer passed to QImage.
This PR forcibly decreases the reference count of the string buffer after use, if necessary. Tested on Windows only. Is there a policy for including (or not) this kind of temporary workaround in matplotlib?
There are other reported problems creating QImage from string buffers at https://bugreports.qt-project.org/browse/PYSIDE-52 .