Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
1 rating:
 1 out of 5     Rate this Document

Out of Memory When Using Bitmap Functions in LabWindows/CVI

Primary Software: LabWindows/CVI Development Systems>>Base Package
Primary Software Version: 8.1
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I'm using some of the bitmap functions from the User Interface libraries in LabWindows/CVI (NewBitmap, GetBitmapFromFile, ClipboardGetBitmap, etc). When I place these functions in a loop, my memory usage starts to go way up and I eventually run out of memory. I am not storing these bitmaps in any sort of data structure or array, just simply writing them to a file. What can I do to stop this memory leak and what is causing it?

Solution:
This is caused because these functions create a bitmap object everytime they are called. This causes the memory usage to grow quickly when inside a loop. To deallocate these objects and free up the memory used, call the function DiscardBitmap(int BitmapID) after you are done using each bitmap.

Related Links:
KnowledgeBase 2CQDSTA6: Improving Performance of LabWindows/CVI Applications

Attachments:





Report Date: 02/20/2007
Last Updated: 03/01/2007
Document ID: 46J7FI9K

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit