Array of bitmaps firing OutOfMemory even having sufficient memory

2

Problem

I have a problem in my program that when the process reaches more than 1.5 GB of memory usage the process stops running and displays a OutOfMemory error.

In my process I'm reading a .AVI file and saving each frame to Array de Bitmaps so I can play it later on a player in a synchronized way.

Doubt

I do not know if Windows limits a array to 1.5 GB and so it fires a memory error even though it has enough space to continue. Has anyone had this problem and know of a solution?

Additional information

There are 4 files in 30FPS with size of 7MB each. My computer is 64Bits , Windows 7 , 8 GB de memória .

    
asked by anonymous 21.02.2014 / 21:06

2 answers

4

I do not believe your problem is a limitation of memory, but a practical aspect of architecture. Environments that need to deal with content that can not be loaded and handled in physical memory usually uses a partial load mechanism. One of them is buffering .

In a classical buffer implementation, the immediately following content (defined by a load window ) of the read cursor is loaded into memory in an operation called < in> read-ahead . Optionally, and depending on the behavior required, the previous content is also sent to the buffer .

As your read cursor moves forward or backward, content present in the opposite direction is discarded, and more content is requested in the direction where reading occurs.

The great advantage of this method is that you keep your memory usage on acceptable terms.

But there is a cost: If your reading cursor moves (skip) to a position beyond the present in the buffer, you have to discard it and reload the new window (re-buffering) .

If your reading cursor moves faster than the content load, you can cause a buffer underrun situation.

    
21.02.2014 / 22:34
1

You did not report the version of the Framework in use, but version 4.5 has an attribute that allows you to extend the 2GB limitation.
gcAllowVeryLargeObjects - On 64-bit platforms, enables arrays that are greater than 2 gigabytes (GB) in total size.

    
21.02.2014 / 21:31