AGW AuiNotebook and memory management

Hi,

I don’t know if it is a memory leak or a normal wxpython / agw / python memory management.

My application displays an AuiNotebook widget and each page of this notebook contains an AuiManager displaying several panels. If several pages are added to the notebook and closed manually, the memory footprint never decrease to its initial state. I can’t say this is a memory leak because for a constant number of pages opened and closed the memory consumption seems stable. The memory occupied by the closed tabs seems never released unless new pages are opened.

Somebody has already heard about this behavior ?

Cheers,

Thierry BRIZZI.

I’ve made a demonstrator that shows a important leak when the AuiManager contains an auto-generated AuiNotebook. This demonstrator uses a default layout containing 5 panels, 3 of them are merged inside a notebook. It uses a timer which opens new pages in the notebook and create the panels inside the page respecting the layout template.

After around 200 pages opened, the demonstrator crashes and the following exception is displayed in my command line tool :

“”"

Traceback (most recent call last):

File “…\nb_leak.py”, line 99, in OnTimer

self.AddNewPage()

File “…\nb_leak.py”, line 110, in AddNewPage

page = MyView(self)

File “…\nb_leak.py”, line 48, in init

self.manager.LoadPerspective(layout, True)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5348, in LoadPerspective

self.Update()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6227, in Update

self.UpdateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6376, in UpdateNotebook

self.CreateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5026, in CreateNotebook

notebook = auibook.AuiNotebook(self._frame, -1, wx.Point(0, 0), wx.Size(0, 0), agwStyle=self._autoNBStyle)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 2689, in init

self._tabs = AuiTabContainer(self)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 803, in init

self._art = TA.AuiDefaultTabArt()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\tabart.py”, line 134, in init

self._disabled_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, wx.Colour(128, 128, 128))

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\aui_utilities.py”, line 141, in BitmapFromBits

img = wx.BitmapFromBits(bits, w, h).ConvertToImage()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx_gdi.py”, line 618, in ConvertToImage

return gdi.Bitmap_ConvertToImage(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “bmp.Ok()” failed at …..\src\msw\dib.cpp(148) in wxDIB::Create(): wxDIB::Create(): invalid bitmap

“”"

If the RELOAD_PERSPECTIVE flag is set to False the layout doesn’t contain any auto-generated notebook and doesn’t crash anymore allowing the notebook to display thousand of pages with few leaks.

I’m using Python 2.7.2, wxPython 2.8.12.1 and AGW 0.9.1.

nb_leak.py (5.38 KB)

···

Le jeudi 7 novembre 2013 13:29:04 UTC+1, Thierry Brizzi a écrit :

Hi,

I don’t know if it is a memory leak or a normal wxpython / agw / python memory management.

My application displays an AuiNotebook widget and each page of this notebook contains an AuiManager displaying several panels. If several pages are added to the notebook and closed manually, the memory footprint never decrease to its initial state. I can’t say this is a memory leak because for a constant number of pages opened and closed the memory consumption seems stable. The memory occupied by the closed tabs seems never released unless new pages are opened.

Somebody has already heard about this behavior ?

Cheers,

Thierry BRIZZI.

I run your test program and its at 300+ and nothing happen… Im using Ubuntu 13.10 64bits, with all the by default libs installed but Python 2.7.5…

Anyways in the real world what kind of software need to create 200+ windows in run time??

···

Saludos / Best regards

Mario Lacunza
Email:: mlacunza@gmail.com
Personal Website:: http://www.lacunza.biz/

Hosting:: http://mlv-host.com/
Mascotas Perdidas:: http://mascotas-perdidas.com/
Google Talk / Y! messenger / Skype: mlacunzav

Lima - Peru

2013/11/7 Thierry Brizzi thierry.brizzi@gmail.com

I’ve made a demonstrator that shows a important leak when the AuiManager contains an auto-generated AuiNotebook. This demonstrator uses a default layout containing 5 panels, 3 of them are merged inside a notebook. It uses a timer which opens new pages in the notebook and create the panels inside the page respecting the layout template.

After around 200 pages opened, the demonstrator crashes and the following exception is displayed in my command line tool :

“”"

Traceback (most recent call last):

File “…\nb_leak.py”, line 99, in OnTimer

self.AddNewPage()

File “…\nb_leak.py”, line 110, in AddNewPage

page = MyView(self)

File “…\nb_leak.py”, line 48, in init

self.manager.LoadPerspective(layout, True)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5348, in LoadPerspective

self.Update()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6227, in Update

self.UpdateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6376, in UpdateNotebook

self.CreateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5026, in CreateNotebook

notebook = auibook.AuiNotebook(self._frame, -1, wx.Point(0, 0), wx.Size(0, 0), agwStyle=self._autoNBStyle)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 2689, in init

self._tabs = AuiTabContainer(self)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 803, in init

self._art = TA.AuiDefaultTabArt()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\tabart.py”, line 134, in init

self._disabled_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, wx.Colour(128, 128, 128))

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\aui_utilities.py”, line 141, in BitmapFromBits

img = wx.BitmapFromBits(bits, w, h).ConvertToImage()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx_gdi.py”, line 618, in ConvertToImage

return gdi.Bitmap_ConvertToImage(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “bmp.Ok()” failed at …..\src\msw\dib.cpp(148) in wxDIB::Create(): wxDIB::Create(): invalid bitmap

“”"

If the RELOAD_PERSPECTIVE flag is set to False the layout doesn’t contain any auto-generated notebook and doesn’t crash anymore allowing the notebook to display thousand of pages with few leaks.

I’m using Python 2.7.2, wxPython 2.8.12.1 and AGW 0.9.1.

Le jeudi 7 novembre 2013 13:29:04 UTC+1, Thierry Brizzi a écrit :

Hi,

I don’t know if it is a memory leak or a normal wxpython / agw / python memory management.

My application displays an AuiNotebook widget and each page of this notebook contains an AuiManager displaying several panels. If several pages are added to the notebook and closed manually, the memory footprint never decrease to its initial state. I can’t say this is a memory leak because for a constant number of pages opened and closed the memory consumption seems stable. The memory occupied by the closed tabs seems never released unless new pages are opened.

Somebody has already heard about this behavior ?

Cheers,

Thierry BRIZZI.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Sorry I’ve not specified that I’m using Windows 7 64bits …

···

Le jeudi 7 novembre 2013 15:33:38 UTC+1, Mario Lacunza a écrit :

I run your test program and its at 300+ and nothing happen… Im using Ubuntu 13.10 64bits, with all the by default libs installed but Python 2.7.5…

Anyways in the real world what kind of software need to create 200+ windows in run time??

Saludos / Best regards

Mario Lacunza
Email:: mlac...@gmail.com
Personal Website:: http://www.lacunza.biz/

Hosting:: http://mlv-host.com/
Mascotas Perdidas:: http://mascotas-perdidas.com/
Google Talk / Y! messenger / Skype: mlacunzav

Lima - Peru

2013/11/7 Thierry Brizzi thierry...@gmail.com

I’ve made a demonstrator that shows a important leak when the AuiManager contains an auto-generated AuiNotebook. This demonstrator uses a default layout containing 5 panels, 3 of them are merged inside a notebook. It uses a timer which opens new pages in the notebook and create the panels inside the page respecting the layout template.

After around 200 pages opened, the demonstrator crashes and the following exception is displayed in my command line tool :

“”"

Traceback (most recent call last):

File “…\nb_leak.py”, line 99, in OnTimer

self.AddNewPage()

File “…\nb_leak.py”, line 110, in AddNewPage

page = MyView(self)

File “…\nb_leak.py”, line 48, in init

self.manager.LoadPerspective(layout, True)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5348, in LoadPerspective

self.Update()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6227, in Update

self.UpdateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6376, in UpdateNotebook

self.CreateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5026, in CreateNotebook

notebook = auibook.AuiNotebook(self._frame, -1, wx.Point(0, 0), wx.Size(0, 0), agwStyle=self._autoNBStyle)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 2689, in init

self._tabs = AuiTabContainer(self)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 803, in init

self._art = TA.AuiDefaultTabArt()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\tabart.py”, line 134, in init

self._disabled_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, wx.Colour(128, 128, 128))

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\aui_utilities.py”, line 141, in BitmapFromBits

img = wx.BitmapFromBits(bits, w, h).ConvertToImage()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx_gdi.py”, line 618, in ConvertToImage

return gdi.Bitmap_ConvertToImage(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “bmp.Ok()” failed at …..\src\msw\dib.cpp(148) in wxDIB::Create(): wxDIB::Create(): invalid bitmap

“”"

If the RELOAD_PERSPECTIVE flag is set to False the layout doesn’t contain any auto-generated notebook and doesn’t crash anymore allowing the notebook to display thousand of pages with few leaks.

I’m using Python 2.7.2, wxPython 2.8.12.1 and AGW 0.9.1.

Le jeudi 7 novembre 2013 13:29:04 UTC+1, Thierry Brizzi a écrit :

Hi,

I don’t know if it is a memory leak or a normal wxpython / agw / python memory management.

My application displays an AuiNotebook widget and each page of this notebook contains an AuiManager displaying several panels. If several pages are added to the notebook and closed manually, the memory footprint never decrease to its initial state. I can’t say this is a memory leak because for a constant number of pages opened and closed the memory consumption seems stable. The memory occupied by the closed tabs seems never released unless new pages are opened.

Somebody has already heard about this behavior ?

Cheers,

Thierry BRIZZI.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

I’ve updated the code to open automatically 20 pages then close them all and restart a 20 pages opening process. The crash arises also even if few files are effectively displayed.

To answer to Mario : Yes, there are few chances to open 200 pages at the same time. But in my mind, it is not rare to do 200 opening operations in a single session.

Regards.

nb_leak.py (5.53 KB)

···

Le jeudi 7 novembre 2013 15:36:50 UTC+1, Thierry Brizzi a écrit :

Sorry I’ve not specified that I’m using Windows 7 64bits …

Le jeudi 7 novembre 2013 15:33:38 UTC+1, Mario Lacunza a écrit :

I run your test program and its at 300+ and nothing happen… Im using Ubuntu 13.10 64bits, with all the by default libs installed but Python 2.7.5…

Anyways in the real world what kind of software need to create 200+ windows in run time??

Saludos / Best regards

Mario Lacunza
Email:: mlac...@gmail.com
Personal Website:: http://www.lacunza.biz/

Hosting:: http://mlv-host.com/
Mascotas Perdidas:: http://mascotas-perdidas.com/
Google Talk / Y! messenger / Skype: mlacunzav

Lima - Peru

2013/11/7 Thierry Brizzi thierry...@gmail.com

I’ve made a demonstrator that shows a important leak when the AuiManager contains an auto-generated AuiNotebook. This demonstrator uses a default layout containing 5 panels, 3 of them are merged inside a notebook. It uses a timer which opens new pages in the notebook and create the panels inside the page respecting the layout template.

After around 200 pages opened, the demonstrator crashes and the following exception is displayed in my command line tool :

“”"

Traceback (most recent call last):

File “…\nb_leak.py”, line 99, in OnTimer

self.AddNewPage()

File “…\nb_leak.py”, line 110, in AddNewPage

page = MyView(self)

File “…\nb_leak.py”, line 48, in init

self.manager.LoadPerspective(layout, True)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5348, in LoadPerspective

self.Update()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6227, in Update

self.UpdateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6376, in UpdateNotebook

self.CreateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5026, in CreateNotebook

notebook = auibook.AuiNotebook(self._frame, -1, wx.Point(0, 0), wx.Size(0, 0), agwStyle=self._autoNBStyle)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 2689, in init

self._tabs = AuiTabContainer(self)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 803, in init

self._art = TA.AuiDefaultTabArt()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\tabart.py”, line 134, in init

self._disabled_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, wx.Colour(128, 128, 128))

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\aui_utilities.py”, line 141, in BitmapFromBits

img = wx.BitmapFromBits(bits, w, h).ConvertToImage()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx_gdi.py”, line 618, in ConvertToImage

return gdi.Bitmap_ConvertToImage(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “bmp.Ok()” failed at …..\src\msw\dib.cpp(148) in wxDIB::Create(): wxDIB::Create(): invalid bitmap

“”"

If the RELOAD_PERSPECTIVE flag is set to False the layout doesn’t contain any auto-generated notebook and doesn’t crash anymore allowing the notebook to display thousand of pages with few leaks.

I’m using Python 2.7.2, wxPython 2.8.12.1 and AGW 0.9.1.

Le jeudi 7 novembre 2013 13:29:04 UTC+1, Thierry Brizzi a écrit :

Hi,

I don’t know if it is a memory leak or a normal wxpython / agw / python memory management.

My application displays an AuiNotebook widget and each page of this notebook contains an AuiManager displaying several panels. If several pages are added to the notebook and closed manually, the memory footprint never decrease to its initial state. I can’t say this is a memory leak because for a constant number of pages opened and closed the memory consumption seems stable. The memory occupied by the closed tabs seems never released unless new pages are opened.

Somebody has already heard about this behavior ?

Cheers,

Thierry BRIZZI.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

I just tested again and no issues with your code.

Trying using the last Python version, you are running an old one.

···

Saludos / Best regards

Mario Lacunza
Email:: mlacunza@gmail.com
Personal Website:: http://www.lacunza.biz/
Hosting:: http://mlv-host.com/

Mascotas Perdidas:: http://mascotas-perdidas.com/
Google Talk / Y! messenger / Skype: mlacunzav

Lima - Peru

2013/11/7 Thierry Brizzi thierry.brizzi@gmail.com

I’ve updated the code to open automatically 20 pages then close them all and restart a 20 pages opening process. The crash arises also even if few files are effectively displayed.

To answer to Mario : Yes, there are few chances to open 200 pages at the same time. But in my mind, it is not rare to do 200 opening operations in a single session.

Regards.

Le jeudi 7 novembre 2013 15:36:50 UTC+1, Thierry Brizzi a écrit :

Sorry I’ve not specified that I’m using Windows 7 64bits …

Le jeudi 7 novembre 2013 15:33:38 UTC+1, Mario Lacunza a écrit :

I run your test program and its at 300+ and nothing happen… Im using Ubuntu 13.10 64bits, with all the by default libs installed but Python 2.7.5…

Anyways in the real world what kind of software need to create 200+ windows in run time??

Saludos / Best regards

Mario Lacunza
Email:: mlac...@gmail.com
Personal Website:: http://www.lacunza.biz/

Hosting:: http://mlv-host.com/
Mascotas Perdidas:: http://mascotas-perdidas.com/
Google Talk / Y! messenger / Skype: mlacunzav

Lima - Peru

2013/11/7 Thierry Brizzi thierry...@gmail.com

I’ve made a demonstrator that shows a important leak when the AuiManager contains an auto-generated AuiNotebook. This demonstrator uses a default layout containing 5 panels, 3 of them are merged inside a notebook. It uses a timer which opens new pages in the notebook and create the panels inside the page respecting the layout template.

After around 200 pages opened, the demonstrator crashes and the following exception is displayed in my command line tool :

“”"

Traceback (most recent call last):

File “…\nb_leak.py”, line 99, in OnTimer

self.AddNewPage()

File “…\nb_leak.py”, line 110, in AddNewPage

page = MyView(self)

File “…\nb_leak.py”, line 48, in init

self.manager.LoadPerspective(layout, True)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5348, in LoadPerspective

self.Update()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6227, in Update

self.UpdateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6376, in UpdateNotebook

self.CreateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5026, in CreateNotebook

notebook = auibook.AuiNotebook(self._frame, -1, wx.Point(0, 0), wx.Size(0, 0), agwStyle=self._autoNBStyle)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 2689, in init

self._tabs = AuiTabContainer(self)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 803, in init

self._art = TA.AuiDefaultTabArt()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\tabart.py”, line 134, in init

self._disabled_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, wx.Colour(128, 128, 128))

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\aui_utilities.py”, line 141, in BitmapFromBits

img = wx.BitmapFromBits(bits, w, h).ConvertToImage()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx_gdi.py”, line 618, in ConvertToImage

return gdi.Bitmap_ConvertToImage(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “bmp.Ok()” failed at …..\src\msw\dib.cpp(148) in wxDIB::Create(): wxDIB::Create(): invalid bitmap

“”"

If the RELOAD_PERSPECTIVE flag is set to False the layout doesn’t contain any auto-generated notebook and doesn’t crash anymore allowing the notebook to display thousand of pages with few leaks.

I’m using Python 2.7.2, wxPython 2.8.12.1 and AGW 0.9.1.

Le jeudi 7 novembre 2013 13:29:04 UTC+1, Thierry Brizzi a écrit :

Hi,

I don’t know if it is a memory leak or a normal wxpython / agw / python memory management.

My application displays an AuiNotebook widget and each page of this notebook contains an AuiManager displaying several panels. If several pages are added to the notebook and closed manually, the memory footprint never decrease to its initial state. I can’t say this is a memory leak because for a constant number of pages opened and closed the memory consumption seems stable. The memory occupied by the closed tabs seems never released unless new pages are opened.

Somebody has already heard about this behavior ?

Cheers,

Thierry BRIZZI.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

I can reproduce this with Python 2.7.5, wx 2.9.4.0, AGW 0.9.6 on Win7-64

Michael

Hi Mario,

This bug seems to be platform specific. As it is a problem linked to Windows GDI interface, it is normal you can’t reproduce the problem on Linux.

In my mind, this problem is serious because even if this exception is catched no more graphical resources are available and prevent the application from displaying anything else.

The same issue arises with the native wx.aui.AuiNotebook and wx.aui.AuiManager. Is there a way to reset GDI resources from my wxPython application ?

It would be great if a wxPython / wxWidgets developer gives me a detailed analysis of this issue.

Thanks.

···

Le jeudi 7 novembre 2013 18:06:24 UTC+1, Mario Lacunza a écrit :

I just tested again and no issues with your code.

Trying using the last Python version, you are running an old one.

Saludos / Best regards

Mario Lacunza
Email:: mlac...@gmail.com
Personal Website:: http://www.lacunza.biz/
Hosting:: http://mlv-host.com/

Mascotas Perdidas:: http://mascotas-perdidas.com/
Google Talk / Y! messenger / Skype: mlacunzav

Lima - Peru

2013/11/7 Thierry Brizzi thierry...@gmail.com

I’ve updated the code to open automatically 20 pages then close them all and restart a 20 pages opening process. The crash arises also even if few files are effectively displayed.

To answer to Mario : Yes, there are few chances to open 200 pages at the same time. But in my mind, it is not rare to do 200 opening operations in a single session.

Regards.

Le jeudi 7 novembre 2013 15:36:50 UTC+1, Thierry Brizzi a écrit :

Sorry I’ve not specified that I’m using Windows 7 64bits …

Le jeudi 7 novembre 2013 15:33:38 UTC+1, Mario Lacunza a écrit :

I run your test program and its at 300+ and nothing happen… Im using Ubuntu 13.10 64bits, with all the by default libs installed but Python 2.7.5…

Anyways in the real world what kind of software need to create 200+ windows in run time??

Saludos / Best regards

Mario Lacunza
Email:: mlac...@gmail.com
Personal Website:: http://www.lacunza.biz/

Hosting:: http://mlv-host.com/
Mascotas Perdidas:: http://mascotas-perdidas.com/
Google Talk / Y! messenger / Skype: mlacunzav

Lima - Peru

2013/11/7 Thierry Brizzi thierry...@gmail.com

I’ve made a demonstrator that shows a important leak when the AuiManager contains an auto-generated AuiNotebook. This demonstrator uses a default layout containing 5 panels, 3 of them are merged inside a notebook. It uses a timer which opens new pages in the notebook and create the panels inside the page respecting the layout template.

After around 200 pages opened, the demonstrator crashes and the following exception is displayed in my command line tool :

“”"

Traceback (most recent call last):

File “…\nb_leak.py”, line 99, in OnTimer

self.AddNewPage()

File “…\nb_leak.py”, line 110, in AddNewPage

page = MyView(self)

File “…\nb_leak.py”, line 48, in init

self.manager.LoadPerspective(layout, True)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5348, in LoadPerspective

self.Update()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6227, in Update

self.UpdateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 6376, in UpdateNotebook

self.CreateNotebook()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\framemanager.py”, line 5026, in CreateNotebook

notebook = auibook.AuiNotebook(self._frame, -1, wx.Point(0, 0), wx.Size(0, 0), agwStyle=self._autoNBStyle)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 2689, in init

self._tabs = AuiTabContainer(self)

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\auibook.py”, line 803, in init

self._art = TA.AuiDefaultTabArt()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\tabart.py”, line 134, in init

self._disabled_right_bmp = BitmapFromBits(nb_right_bits, 16, 16, wx.Colour(128, 128, 128))

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx\lib\agw\aui\aui_utilities.py”, line 141, in BitmapFromBits

img = wx.BitmapFromBits(bits, w, h).ConvertToImage()

File “C:\Program Files (x86)\Python27\Lib\site-packages\wx-2.8-msw-unicode\wx_gdi.py”, line 618, in ConvertToImage

return gdi.Bitmap_ConvertToImage(*args, **kwargs)

wx._core.PyAssertionError: C++ assertion “bmp.Ok()” failed at …..\src\msw\dib.cpp(148) in wxDIB::Create(): wxDIB::Create(): invalid bitmap

“”"

If the RELOAD_PERSPECTIVE flag is set to False the layout doesn’t contain any auto-generated notebook and doesn’t crash anymore allowing the notebook to display thousand of pages with few leaks.

I’m using Python 2.7.2, wxPython 2.8.12.1 and AGW 0.9.1.

Le jeudi 7 novembre 2013 13:29:04 UTC+1, Thierry Brizzi a écrit :

Hi,

I don’t know if it is a memory leak or a normal wxpython / agw / python memory management.

My application displays an AuiNotebook widget and each page of this notebook contains an AuiManager displaying several panels. If several pages are added to the notebook and closed manually, the memory footprint never decrease to its initial state. I can’t say this is a memory leak because for a constant number of pages opened and closed the memory consumption seems stable. The memory occupied by the closed tabs seems never released unless new pages are opened.

Somebody has already heard about this behavior ?

Cheers,

Thierry BRIZZI.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.

Hi Thierry,

I just noticed that your traceback shows that you are using wxPython 2.8, have you tried using 2.9.5? If you can't go to 2.9.5 you should still be able to use the latest copy of agw from SVN.

When you create all these windows are you making sure that they get deleted after you are done with them and you don't keep some reference hanging around.

Werner

Hi Werner,

I’ve tried with the latest version of WxPython and the same issue arises. Moreover it is not linked to AGW library as it crashes also using wx.aui widgets.

The destruction process is not involved as the crash happens even if pages are opened and not closed.

I don’t know exactly how GDI resources are managed, but maybe resource limitations are artificial and could be increased manually ?

···

Le vendredi 8 novembre 2013 10:42:29 UTC+1, werner a écrit :

Hi Thierry,

I just noticed that your traceback shows that you are using wxPython
2.8, have you tried using 2.9.5? If you can’t go to 2.9.5 you should
still be able to use the latest copy of agw from SVN.

When you create all these windows are you making sure that they get
deleted after you are done with them and you don’t keep some reference
hanging around.

Werner

Hi,

I've a bit more investigated concerning GDI resources. It seems impossible on Windows 7 to create more than 10000 GDI objects. For the time being, I've not found a way to overcome this limitation. This limit explains why opening a plenty of tabs containing several AuiManager objects makes my application crash.

But now I cannot say anymore wx.aui is also touched by this issue because the GDI objects are not release when the AuiManager contained in a tab contains also one or several notebooks and only AGW's AuiManager allows that. This can be reproduced by enabling / disabling perspective management in the demonstrator I've already provided by setting the variable LOAD_PERSPECTIVE to True / False.

Now, I'll try to figure out what is wrong with AuiNotebooks.

Regards.

Hi,
I’ve a bit more investigated concerning GDI resources. It seems impossible on Windows 7 to create more than 10000 GDI objects. For the time being, I’ve not found a way to overcome this limitation. This limit explains why opening a plenty of tabs containing several AuiManager objects makes my application crash.

But now I cannot say anymore wx.aui is also touched by this issue because the GDI objects are not release when the AuiManager contained in a tab contains also one or several notebooks and only AGW’s AuiManager allows that. This can be reproduced by enabling / disabling perspective management in the demonstrator I’ve already provided by setting the variable LOAD_PERSPECTIVE to True / False.

Now, I’ll try to figure out what is wrong with AuiNotebooks.

Regards.

Don’t Start Buggggggg(g)*100 Testing with 1000. Start with 10. Maybe then jump the number to -1 of what the issue occurs…
Your nb_leak.py seems to stop/continue iterating silently at 215 on WinXPPro SP3.

@Note: some stuff might be hard coded… Ex: 255 for colors, (64, 128, 256, 512, 1024, etc) chars for others, etc, etc… maybe this…
I know Pillow has a font render limit…
Ex:

if i > 3000: # BUG/TODO looks like 4501 breaks it…
…so…

ATM…
It seems the bugs are there… What OS are you using…? What is the break limit…? What is the crash memroy overload level…?
Table this or obvious and it should come full shore.

if bugREQz:
try:
del object # Ex: NB Page, whatever…
except Exception as exc:
raise exc # Then handle it…maybe…
else:
try:
DevAnAlternativeSolution() or Workaround()
except Exception as exc:
print(‘del from python didn’t work… hmmm’)
raise exc

try tweaking it a bit. Sometimes crashing is the only way to debug a particular problem.
@Note: Image related problems will likely crash before giving you a traceback, hence attempting other measures.

···

On Sunday, November 10, 2013 12:05:19 PM UTC-6, Thierry Brizzi wrote:

Hi,

I’ve finally found the solution in ticket #14670 registered but not solved in the wxPython bug tracker and applied it to my demonstrator. To release the resources occupied by AuiNotebooks created automatically by an AuiManager when several panels are merged, it is necessary to destroy the AuiManager used internally by an AuiNotebook. With this little correction, the demonstrator is able to open thousand of pages.

To answer to Metallicow, the demonstrator I’ve provided is not perfect and quite rigid. But it was the only way to prove there’s something wrong with AGW, have some attention from wxPython developers, help them to understand my problem, hope one day there’s a patch correcting my issue. Moreover, I’m really happy to provide a correction to my initial code if I find a solution to help developers to make this saving patch. It took some times to develop this piece of code and as a humble user I think it is not my work to make a detailed quantitative characterization of my issue that a wxPython developer can do better than me.

WxPython is a great tool that I’m using since 2 years. When I’m facing a problem that I cannot solve or dodge because it requires low level knowledge I’m forced to ask some help to the wxPython user list. But the solution often comes from my personnal implication in all of these low level stuffs. Sometimes it is quite tempting to switch to another graphical library and discouraging to face off a problem with any constructive help of a developer like pointers to other email threads or tickets or solve it without any feedback.

5 days to have an answer from a wxPython developer is a bit long. Having as an answer methods telling me how to debug a program while I’ve already delivered a functionnal one showing exactly my problem is too much.

Regards.

nb_leak.py (6.25 KB)

···

Le mardi 12 novembre 2013 13:19:39 UTC+1, Metallicow a écrit :

On Sunday, November 10, 2013 12:05:19 PM UTC-6, Thierry Brizzi wrote:

Hi,
I’ve a bit more investigated concerning GDI resources. It seems impossible on Windows 7 to create more than 10000 GDI objects. For the time being, I’ve not found a way to overcome this limitation. This limit explains why opening a plenty of tabs containing several AuiManager objects makes my application crash.

But now I cannot say anymore wx.aui is also touched by this issue because the GDI objects are not release when the AuiManager contained in a tab contains also one or several notebooks and only AGW’s AuiManager allows that. This can be reproduced by enabling / disabling perspective management in the demonstrator I’ve already provided by setting the variable LOAD_PERSPECTIVE to True / False.

Now, I’ll try to figure out what is wrong with AuiNotebooks.

Regards.

Don’t Start Buggggggg(g)*100 Testing with 1000. Start with 10. Maybe then jump the number to -1 of what the issue occurs…
Your nb_leak.py seems to stop/continue iterating silently at 215 on WinXPPro SP3.

@Note: some stuff might be hard coded… Ex: 255 for colors, (64, 128, 256, 512, 1024, etc) chars for others, etc, etc… maybe this…
I know Pillow has a font render limit…
Ex:

if i > 3000: # BUG/TODO looks like 4501 breaks it…
…so…

ATM…
It seems the bugs are there… What OS are you using…? What is the break limit…? What is the crash memroy overload level…?
Table this or obvious and it should come full shore.

if bugREQz:
try:
del object # Ex: NB Page, whatever…
except Exception as exc:
raise exc # Then handle it…maybe…
else:
try:
DevAnAlternativeSolution() or Workaround()
except Exception as exc:
print(‘del from python didn’t work… hmmm’)
raise exc

try tweaking it a bit. Sometimes crashing is the only way to debug a particular problem.
@Note: Image related problems will likely crash before giving you a traceback, hence attempting other measures.

I don’t see your demonstrator attached to that ticket.
BTW, infinity77 (Andrea Gavana) is the dev of agw.aui and according
to his post (of 14 month ago) there is a similar fix applied to
SVN. I can’t remember did you test against SVN?
I think a patch against current SVN for wxPython and/or Phoenix
would probably speed up the inclusion of any fix.
Just my 0.02€
Werner

···

Hi Thierry,

  On 12/11/2013 15:52, Thierry Brizzi wrote:

Hi,

I’ve finally found the solution in ticket #14670 registered
but not solved in the wxPython bug tracker and applied it to
my demonstrator. To release the resources occupied by
AuiNotebooks created automatically by an AuiManager when
several panels are merged, it is necessary to destroy the
AuiManager used internally by an AuiNotebook. With this little
correction, the demonstrator is able to open thousand of
pages.

Hi Werner,

Yes, I’ve been a bit lazy. I’ll attach this demonstrator soon.

I’ve not tested against the last SVN version because the ticket has not been closed and let me think the problem wasn’t fixed.

Cheers.

···

Le mardi 12 novembre 2013 16:16:40 UTC+1, werner a écrit :

Hi Thierry,

  On 12/11/2013 15:52, Thierry Brizzi wrote:

Hi,

I’ve finally found the solution in ticket #14670 registered
but not solved in the wxPython bug tracker and applied it to
my demonstrator. To release the resources occupied by
AuiNotebooks created automatically by an AuiManager when
several panels are merged, it is necessary to destroy the
AuiManager used internally by an AuiNotebook. With this little
correction, the demonstrator is able to open thousand of
pages.

I don’t see your demonstrator attached to that ticket.

BTW, infinity77 (Andrea Gavana) is the dev of agw.aui and according

to his post (of 14 month ago) there is a similar fix applied to
SVN. I can’t remember did you test against SVN?

I think a patch against current SVN for wxPython and/or Phoenix

would probably speed up the inclusion of any fix.

Just my 0.02€

Werner

Thierry Brizzi wrote:

Hi Werner,

Yes, I've been a bit lazy. I'll attach this demonstrator soon.

I've not tested against the last SVN version because the ticket has not
been closed and let me think the problem wasn't fixed.

Cheers.

Le mardi 12 novembre 2013 16:16:40 UTC+1, werner a �crit :

Hi Thierry,

Hi,

I've finally found the solution in ticket #14670
<wxTrac has been migrated to GitHub Issues - wxWidgets; registered but not solved
in the wxPython bug tracker and applied it to my demonstrator. To
release the resources occupied by AuiNotebooks created
automatically by an AuiManager when several panels are merged, it
is necessary to destroy the AuiManager used internally by an
AuiNotebook. With this little correction, the demonstrator is able
to open thousand of pages.

I don't see your demonstrator attached to that ticket.

BTW, infinity77 (Andrea Gavana) is the dev of agw.aui and according
to his post (of 14 month ago) there is a similar fix applied to SVN.
I can't remember did you test against SVN?

I think a patch against current SVN for wxPython and/or Phoenix
would probably speed up the inclusion of any fix.

Yes. Since I am not super familiar with the agw.aui code then to move this forward we will definitely need a patch implementing the fix so I can apply it without fear of making the right change in the wrong place or vice versa. Since Andrea is taking time off then we will also need someone else who is familiar with the agw.aui code (or willing to become so) to review and verify that the patch fixes the problem and is correct. Bonus points for taking care of the Phoenix version too.

···

On 12/11/2013 15:52, Thierry Brizzi wrote:

--
Robin Dunn
Software Craftsman

Hi Thierry,

Thierry Brizzi wrote:

....

BTW, infinity77 (Andrea Gavana) is the dev of agw.aui and according
to his post (of 14 month ago) there is a similar fix applied to SVN.
I can't remember did you test against SVN?

I think a patch against current SVN for wxPython and/or Phoenix
would probably speed up the inclusion of any fix.

Yes. Since I am not super familiar with the agw.aui code then to move this forward we will definitely need a patch implementing the fix so I can apply it without fear of making the right change in the wrong place or vice versa. Since Andrea is taking time off then we will also need someone else who is familiar with the agw.aui code (or willing to become so) to review and verify that the patch fixes the problem and is correct. Bonus points for taking care of the Phoenix version too.

I am having another look at this and I am a bit confused what you are actually doing.

When I run your nb_leak.py it fails after about 80 notebook pages having been added in AddNewPage. When I look at MyView Class I see a a call to LoadPerspective which to me doesn't really make sense.

What is the idea behind you reloading a base perspective on each call of 'AddNewPage'?

If I just comment that line the code runs way passed 80 notebook pages.

If this is still an issue for you and you would like to see it corrected can you please provide additional information.

Werner

···

On 18/12/2013 05:58, Robin Dunn wrote: