Aui ScrolledPanel Win7 resource usage problem

Hello,

I'm currently developing my first wxPython application,
and I hope someone can help with this:

I create AUI with a ScrolledPanel,
inside a couple of hundred TextCtrls.

Please see attached testcase.

Scrolling that panel increases memory usage quite a bit.
If I use the mouse wheel and just scroll up+down a few times,
I can use up ~1GB RAM in about 10 seconds.

Worse, a moment after I stop scrolling, the whole Desktop freezes for a while,
then comes back with RAM usage as it was before I started.
"Freezes" as in: Does not respond to input, no windows become updated.

Additional Points:
This does not happen on Windows Server 2008.
This does not happen on Windows 7 with the design service stopped.

wxPython versions tried: 2.8.12.1, 2.9.4.0, 2.9.5.0b
Python 2.7

Using ScrolledWindow instead of ScrolledPanel makes no difference,
not putting everything into sizers doesn't either.

Thank you,

Michael

test2.py (3.23 KB)

Hi Michael,

No idea about your memory use problem, but looking at the code I wonder if you use the best controls.

To me it looks like you are listing lots of similar data, wouldn't a listctrl be better for something like that.

Just a thought
Werner

Hi Werner,

thanks for looking at it.

I was thinking about using Grid,
but out-of-the box it seemed to lack a few features I need:
- single-click actions per row ( like "delete", "open context screen";
   the context menu is one extra click as the customer will tell me )
- multi-column sorting
- row filtering
so I thought I'd try to roll my own.

After taking a deeper look a Grid yesterday I think I'll use that and start from there.

Thanks again,

Michael

···

On Wed, 14 Aug 2013 20:47:56 +0200, werner <wbruhin@free.fr> wrote:

Hi Michael,

No idea about your memory use problem, but looking at the code I wonder if you use the best controls.

To me it looks like you are listing lots of similar data, wouldn't a listctrl be better for something like that.

Just a thought
Werner

Hi Michael,

Hi Michael,

No idea about your memory use problem, but looking at the code I wonder if you use the best controls.

To me it looks like you are listing lots of similar data, wouldn't a listctrl be better for something like that.

Just a thought
Werner

Hi Werner,

thanks for looking at it.

I was thinking about using Grid,
but out-of-the box it seemed to lack a few features I need:
- single-click actions per row ( like "delete", "open context screen";
  the context menu is one extra click as the customer will tell me )
- multi-column sorting
- row filtering
so I thought I'd try to roll my own.

After taking a deeper look a Grid yesterday I think I'll use that and start from there.

Other things to look at are:

http://objectlistview.sourceforge.net/python/majorClasses.html

A patched version (to make it compatible with recent wxPython versions) is available within the MediaLocker project:
https://bitbucket.org/driscollis/medialocker

You should also look at the "DVC" controls which are available in recent wxPython versions - I think 2.9+.

Last but not least the UltimateListCtrl part of wx.lib.agw.

Werner

···

On 15/08/2013 18:46, Michael Ross wrote:

On Wed, 14 Aug 2013 20:47:56 +0200, werner <wbruhin@free.fr> wrote:

werner wrote:

Hi Michael,

No idea about your memory use problem, but looking at the code I wonder
if you use the best controls.

To me it looks like you are listing lots of similar data, wouldn't a
listctrl be better for something like that.

I don't have any ideas about the memory usage either, but I agree about the choice of widget. Any time there are many identical rows of widgets it is just crying out to be something like a listctrl or a grid.

ALso, the panel should be a child of the notebook not the frame.

···

--
Robin Dunn
Software Craftsman

Hi Robin,

You're right of course about the parenting,
doesn't mitigate the problem though.

I'm quite positive that I'll be able to put controls inside Grid's LabelRenderer,
so I'll probably manage with 2 Grids and a ListCtrl -- the data is not that uniform as my testcase has suggested.

Playing around a bit I found that there seem's to be a limit on how many Controls I can put inside a panel before the problem occurs.
For example, I can put 500 StaticTexts in there no problem, but at 600 StaticTexts the problem occurs.
200 Grids are ok, 400 Grids are not.

The extent of the memory/resource exhaustion differs between scrolling using the scrollbar (bad) and scrolling using the mouse wheel (much worse).

My guess would be that with >x Controls, scrolling events get produced (much) too many or too fast, that is, faster than redrawing happens, and the events get stockpiled; maybe that would explain the locking-up for a while of the whole GUI once I stop continuously producing new events.
That would fit the problem being mitigated by disabling Windows's design service, without that (re)drawing is much faster. (I'm really just guessing here.)

Thanks,

Michael

···

On Sat, 24 Aug 2013 03:09:36 +0200, Robin Dunn <robin@alldunn.com> wrote:

werner wrote:

Hi Michael,

No idea about your memory use problem, but looking at the code I wonder
if you use the best controls.

To me it looks like you are listing lots of similar data, wouldn't a
listctrl be better for something like that.

I don't have any ideas about the memory usage either, but I agree about the choice of widget. Any time there are many identical rows of widgets it is just crying out to be something like a listctrl or a grid.

ALso, the panel should be a child of the notebook not the frame.