07-09-2011 05:28 AM
Anyone who can help please:-
I am running an automatic test program which plots a graph, and then saves the plot to hard drive using the GetPanelDisplayBitmap function and the SaveBitmapToPNGFile function. This all works fine for around 90 iterations, and then the program fails with the -12 'Out of Memory' error on the GetPanelDisplayBitmap function, even though the plot and panel being saved is always the same size.
I need this routine to run continuously - is there anyway of releasing the memory that appears to be being consumed by...what??
The code is as follows:
panel_handle = GetActivePanel (); // gets the displayed panel GetPanelDisplayBitmap (panel_handle, VAL_VISIBLE_AREA, VAL_ENTIRE_OBJECT, &displayed_panel); Fmt(file_name,"%s<%s%s%s %f[p0] - %f[p0] #%i%s",Store_Path,"\\",tab_name,F1,F2,file_number,".png"); SaveBitmapToPNGFile (displayed_panel, file_name);
Thanks in anticipation of any help,
Allen Cherry
Solved! Go to Solution.
07-09-2011 06:00 AM
Hi,
I think you should discard the bitmap after use using the function DiscardBitmap. This will free the memory allocated for the bitmap and avoid the out of memory error.
Wolfgang
07-09-2011 06:04 AM
Hi Wolfgang,
Many thanks for your reply - how on earth did I miss such an obvious function!!!
I'll add it to the code and give it a try.
Best wishes,
Allen