Author Topic: Memory Leak?  (Read 1429 times)

Offline spflanze

  • Almost regular
  • **
  • Posts: 133
Memory Leak?
« on: September 13, 2017, 11:45:43 pm »
I followed this tutorial to its end:

At the bottom of this tutorial there are instructions to add this code:

Code: [Select]
void Tutorial_4Frame::OnButton2Click(wxCommandEvent& event)
    FirstDialog* dlg = new FirstDialog(this);

void Tutorial_4Frame::OnButton3Click(wxCommandEvent& event)
    FirstFrame* frm = new FirstFrame(this);

I cannot find where in the code the dlg and frm objects are deleted. Does this project created according to this tutorial's instructions leak memory?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5295
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.