Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

memory leak using CWGraph

I have a memory leak problem using the CWGraph control.
I have an SDI application (MFC using Measurement Studio) and I generate dynamicaly a dialog containing a 2D Graph, and I use the OnTimer() of the dialog to generate data and to update the graph, with a timer of 50ms. In OnTimer() function I have a loop to generate
and to update two plots on the graph. When I call a method of the graph (for example for changing the color of the plot or for updating a plot (using PlotXvsY)), I have a periodic increasing of memory with a fixed amount of memory (4k). In the same OnTimer() function I update also some CWSlide controls without memory leaks.

If I comment the line that call a method of graph
(ex. m_Graph.Plots.Item(1)....), the code works wi
thout memory leaks.

I'll apreciate any suggestion about this problem.
0 Kudos
Message 1 of 2
(3,156 Views)
I had the same memory leak problem with my program as well. I do not think it is because of using CWGraph. Memory leaks occur when you allocate memory and did not free them. The problem will accumulate and crashed randomly (sometime it crashed when you just move mouse around). Try this: if the program does not crash (memory leak crash) on the first time it compiles and runs, it is probable has nothing to do with the CWGraph. On the second and third run, if you did not free variable, the program will usually crashed. If your program crashed on the first time it runs, the problem might be something else.
0 Kudos
Message 2 of 2
(3,155 Views)