LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetPanelDisplayBitmap out of memory error

Solved!
Go to solution

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

0 Kudos
Message 1 of 3
(3,038 Views)
Solution
Accepted by topic author allencherry

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

Message 2 of 3
(3,036 Views)

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

0 Kudos
Message 3 of 3
(3,033 Views)