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.