WxWidgets:Memory
lastmod 2026-11-10created 2017-04-262 edits
WxWidgets:Memory covers how to avoid memory leaks in wxWidgets applications. Window (wxWindow) objects are created on the heap with new, and because a parent window automatically destroys its children, you must call Destroy() instead of using delete directly, and also follow the ownership rules for sizers and controls. On the other hand, some objects such as wxString and dialogs are created and used on the stack, so the key is to tell the two rules apart.