简体   繁体   中英

MSTest Out of memory exception

Im having some problems running a test that creates a very large byte array (~4GB).

When i run it on a release/debug mode, everything works great, but when i run a test which initializes this array, i get OutOfMemory exception

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

At first i thought since i have alot of tests that initialize this big array then i get an out of memory exception, but even when running a single test i get the same exception.

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

Thanks for the helpers :)

Found the issue...

The test used QTAgent32 (32bit) and not QTAgent (64bit).

The solution was to select "Run tests in 64 bit process on 64 bit machine" in testsettings (under Host).

它帮助我:editbin / LARGEADDRESSAWARE“C:\\ Program Files(x86)\\ Microsoft Visual Studio 10.0 \\ Common7 \\ IDE \\ QTAgent32.exe”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM