Nev,
From a quick look at your demo each time that you are creating a pane you are creating a whole new notebook then on closing the pane you ask AUI Manager to destroy the pane but this leaves the notebook, generally you would normally create the Notebook once, use it adding and removing panes as needed, then destroy it at the end of the program. BTW have you thought of hiding and showing panes rather than creating/deleting – this tends to be faster and have less resource issues (as the resource count is fixed).
Steve
--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/wxpython-users/94576b15-ef4d-4f19-babb-3cd2d012b629%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Nev,
From a quick look at your demo each time that you are creating a pane you are creating a whole new notebook then on closing the pane you ask AUI Manager to destroy the pane but this leaves the notebook, generally you would normally create the Notebook once, use it adding and removing panes as needed, then destroy it at the end of the program. BTW have you thought of hiding and showing panes rather than creating/deleting – this tends to be faster and have less resource issues (as the resource count is fixed).
Steve
From: wxpytho...@googlegroups.com <wxpytho...@googlegroups.com>
On Behalf Of Nev
Sent: 04 July 2019 07:33
To: wxPython-users <wxpytho...@googlegroups.com>
Subject: Re: [wxPython-users] Win10 memory leak / GDI Object issue
[Steve Barnes] <Snip>
Thanks for the suggestions, Steve. Yes, I see now that a lot of my initial choices were rather inefficient. With more re-use of existing objects, and more show/hide rather than create/destroy, I think I could avoid this problem for far longer. Unfortunately in the short term, I'm mostly stuck with what I currently have.
In the demo, I think destroying the pane is also destroying the notebook itself (actually, isn't the notebook itself the pane?). At least, if I do a notebook.Destroy() before the ClosePane, the result is the same.
I've found that if I swap-out a vanilla wx.Notebook instead of the wx.lib.agw.aui.AuiNotebook, the problem goes away, so I think this is a reproducable GDI object leak in the AuiNotebook. Just not sure if it's worth posting a bug report? It seems to have been there for years, but I guess it only causes a problem for people who make bad design choices!
[Steve Barnes]
Nev,
I would say that it is worth reporting, not necessarily so much in the hope of it getting fixed as to record possible mitigating approaches for anybody else hitting this problem.
The root cause may well be that if you are frequently deleting and recreating lots of GUI objects then you may hit the GUI limit before they are all garbage collected, (deleting a top level object just reduces the reference instance count of the child objects to zero and lets gc take care of actually removing them.
Steve