[PyKDE] ANN: SIP v4.2rc2 Released

Nahuel Greco nahuel at puntorojo.com.ar
Thu Feb 17 21:56:13 GMT 2005

On Thu, 17 Feb 2005 17:03:16 -0000 (GMT)
"Phil Thompson" <phil at riverbankcomputing.co.uk> wrote:

> Gentoo (x86 and amd64). I didn't run the C++ test - I was refering to the
> original Python test that Torsten sent me.

Ok, I was confused because I tought that you were having different results
with the C++ test, so I thinked that maybe the problem was in Qt 3.3.3 and
in 3.3.4 it was fixed. 

I talked with the qt-bugs folks, they said (about the C++ test):

 "Yes. The problem is that Xlib allocates memory when you call certain
  functions (which is what the QWidget constructor ends up doing) and
  these memory blocks are not freed before other X functions are called.
  So if you insert a call to QApplication::processEvents() in your loop
  then you will no longer see increased memory usage. You can check this
  yourself by using valgrind and forcing the application to quit after
  the loop is done (i.e. by calling abort(3)) and run valgrind with the
  "--leak-check=yes" argument. You will then see that most, if not all,
  of the memory used at that point is allocated by Xlib. If you call
  QApplication::processEvents() then Xlib will have freed the memory
  before the application terminates. Do note that this is only a problem
  while your loop is spinning, the memory is actually freed when the loop
  returns even though top or vmsize might tell you otherwise."

So I inserted a processEvents() in the middle of the C++ loop, and now it
seems ok. But then I tried doing the same with my Python test, inserting
that processEvents() call, but that didn't fix it. 

Now I have the equivalent program done in C++ and PyQT, and the C++ one
don't leak but the PyQT one keeps leaking. I'm attaching the new version
of both and their output. 

What I don't understand is why you aren't seeing the same behaviour, I
tried with Qt 3.3.3 / 3.3.4, with the sip/pyqt version packaged for Debian
and with the latest sip/pyqt snapshot. So maybe the problem is in another
library, I don't know, maybe I must install your Gentoo version and then
copy one by one the pyqt required libraries to the Debian machine, to see
where the correct behaviour shows. Do you have any idea of how I can
continue the investigation?

Note, the C++ program now have a weird behaviour,when you close the window,
the process didn't finish and the memory usage begins to increase. I
don't think that this is related to the problem.

Nahuel Greco.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_cpp_leak.cpp
Type: text/x-c++src
Size: 2147 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050217/e5e4a041/test_cpp_leak.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_py_leak.py
Type: text/x-python
Size: 1963 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050217/e5e4a041/test_py_leak.py
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_cpp_leak.log
Type: application/octet-stream
Size: 5359 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050217/e5e4a041/test_cpp_leak.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_py_leak.log
Type: application/octet-stream
Size: 1398 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20050217/e5e4a041/test_py_leak.obj

More information about the PyQt mailing list