MSTest Out of memory exception

I have some problems running a test that creates a very large array of bytes (~ 4 GB).

When I run it in release / debug mode, everything works fine, but when I run a test that initializes this array, I get an OutOfMemory exception

for (int i = 0; i < 56000; i++) { m_BlocksFree.Enqueue(new byte[65536]); } 

At first I thought, since I have many tests that initialize this large array, then I get an exception from memory, but even when I run one test, I get the same exception.

Im writing in C # and working with MSTest, Rhinomocks and structureMap, win7 64bit.

Thanks for the helpers :)

+4
source share
2 answers

Problem detected ...

The test uses QTAgent32 (32 bits), not QTAgent (64 bits).

The solution was to select "Run tests in a 64-bit process on a 64-bit machine" in the test settings (in the "Host" section).

+5
source

This helps me: editbin / LARGEADDRESSAWARE "C: \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ Common7 \ IDE \ QTAgent32.exe"

+2
source

Source: https://habr.com/ru/post/1486131/


All Articles