CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 53

Threaded View

  1. #13
    Join Date
    Jun 2012
    Posts
    37

    Re: Pass a vector from a pushbutton in dialog class to ONDRAW () in the view.cpp

    Quote Originally Posted by Paul McKenzie View Post
    That doesn't address the issue about the memory leak.

    How many times is OnPlot() called? Multiply that by 500 (or more) bytes, and that is how much total memory is leaked by that function. So if the function is called 1,000 times, that's 500,000 bytes leaked. Sooner or later, your app will die due to the memory leakage.

    There is no need to be using new[] in that OnPlot() function. Either declare a regular array, or use vector<TCHAR>. It makes no sense to use vector everywhere and then not use it for what vector was designed for.

    Regards,

    Paul McKenzie


    ONPLOT() is not called repeatedly. On pressing the PLOT button in a dialog box designed it starts executing the codes writen to generate the RGB vector.


    Further I would like to make a note that when i remove this line
    Code:
    pDoc->RGBVector.push_back(temp);
    everything works fine..Loops and all run fine.. Nothing gets stuck ..
    Last edited by tarkes; June 5th, 2012 at 03:19 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured