Page 1 of 1

Freeing of memory used by controls

Posted: Wed Aug 15, 2018 10:23 am
by deepti
Hi,

There is a dialog I've created which has all controls created using "new". I have read that just calling "Destroy()" when the dialog is closed is sufficient. And wxWidgets internally frees up memory taken up by all controls. Could you please confirm that this is the case?

Thank you!

Re: Freeing of memory used by controls

Posted: Wed Aug 15, 2018 10:28 am
by doublemax
Any wxWindow (this includes wxFrame, wxDialog etc) destroys all its children and its sizer when getting destroyed. As this happens recursively, you usually don't have to destroy any controls created with new.

There are a few exceptions though, but these are mentioned in the documentation for the respective class.

Re: Freeing of memory used by controls

Posted: Wed Aug 15, 2018 11:03 am
by deepti
Thank you for the reply!!!