LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetBitmapFromFile out of memory

Solved!
Go to solution

Robin -

 

Unfortunately, it is not.  The implementation is buried deep within our runtime.  If things still look fishy after you do some further testing, I'd be happy to take a look at your test program.

 

NickB

National Instruments

0 Kudos
Message 11 of 14
(1,095 Views)

Nick:

I modified my test application and compiled it using CVI 8.0.1 - attached

On XP systems it still fails with my test pictures of 2.2Mb. but works fine will smaller pix 300K or less - for a while that is. It usually fails on the first large picture.

The Windows-7 works great up to about 40 big pictures of 2.2Mb - after that it will only load smaller pictures, but the win-7 system only has one small video card with one 1920x1080 monitor on it.

It's an AMD 760G video card with 256Mb video memory and shares 128Mb system memory.  Even after jamming it with pictures until it fails, the OS still releases 200Mb if I call malloc().

My conclusion is that you are on the right track.  Video memory is probably the issue, Windows-7 works much, much better but the system I have is an entirely different configuration.

I'm not ready to say that the problem is resolved, but my work-around is to resize the JPEG images into 30K thumbnails and put them in a subdir then load those images into the table.

Then when my user selects a picture they like, I'll select the full-sized image for the output.  Pressure is on, got a deadline coming up so gotta do the workaround until I find a cleaner solution.

I'll keep watching for posts -- Thanks!

Robin Knoke
CVI Developer since 1994
0 Kudos
Message 12 of 14
(1,082 Views)

Hey Robin - 

 

After looking at your code, I think things are behaving as we would expect them to.  I tested on a 32 bit XP machine, with a jpg image that was 7 mb (4592x3056).  I was able to load the file 6 times, and then the file failed on the 7th time.  

 

One thing I haven't talked about yet is that the size on disk of the jpg image does not actually matter.  It's the actual width and height of the image, in addition to the color depth of you display, that determine how much memory is required to load the image.  In the case of my image, this comes out to the following:  4592 * 3056 * 24 (depth) * 6 (num images) / 8 = ~250 MB.  Because the computer I'm on uses a 256 MB video card, this seems to be bumping into the video memory limit.

 

My guess is that on the Windows 7 machine, you're actually running into the memory limit for your application.

 

I should also mention that there have been a number of improvements to the memory management of these functions since CVI 8.0.1, so I would recommend using the latest run-time engine for your application.

 

NickB

National Instruments

0 Kudos
Message 13 of 14
(1,051 Views)

Nick:

 

I signed off on the original posting as Accepted. Your explanation that GetBitmapFromFile was using video memory explains everything.

BTW, I was testing using both CVI 8.0.1 and CVI 9.1.1, therefore was using the latest rte.

Thanks for the help.

-Robin

 

Robin Knoke
CVI Developer since 1994
0 Kudos
Message 14 of 14
(1,013 Views)