07-02-2009 06:31 PM
Hi,
I use a old version of CVI to develop the application. I use graph to display a kind of image movement. So First I have a loop to use
thanks,
Eric
07-06-2009 05:53 PM
Hi Eric,
The likely reason that you are seeing a memory leak is that you need to delete the reference to the plot before the last image was added. Each time you plot an image, a new plot is created in your control, so we need to use the DeleteGraphPlot function to clear the old reference. This can be accomplished using something like this:
oldPlotHandle = PlotBitmap (panelHandle, PANEL_GRAPH1, x, y, width, height, fileName[]);
loop
{
DeleteGraphPlot(panelHandel,PANEL_GRAPH1,oldPlotHandle,VAL_DELAYED_DRAW)
oldPlotHandle = PlotBitmap (panelHandle, PANEL_GRAPH1, x, y, width, height, fileName[]);
}
You shouldnt need to use DiscardBitMap(), since PlotBitmap does not create an image ID, only a plot handle. hope this helps!
07-07-2009 08:28 AM
Hi AI,
thank you for your reply.
Actually since the beginning the function DeleteGraphPlot is called to delete all plots for each loop (with the plothandle -1, besides plotbitmap, application also plot point and text). After application runs a while, it starts return -12 for function PlotBitmap from time to time. After checking the forum here, I decided to add DiscardBitmap() function. Any other suggestion?
Eric