MSTest – Out of Memory – LAA for 32-bit Test Agent


The CI (Jenkins) build server recently failed a few unit tests randomly and after I downloaded the test report (trx file), I found out the reasons that tests failed are ‘out of memory’ exception being thrown.

failed-unit-tests-because-of-out-of-memory-laa MSTest - Out of Memory - LAA for 32-bit Test Agent 32 bit CI server unit tests

failed-unit-tests-because-of-out-of-memory-laa

The CI server is x64 bit and has 8GB RAM which should be more than enough (Jenkins Java.exe only uses around 400MB RAM). And I suddenly realized that the test agent (mstest) may not be LAA (Large Address Aware) for 32-bit unit tests. Then I run the following command as the Administrator:

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

This is because mstest.exe (or msbuild.exe /test) spawns QTAgent32.exe if mstest run at x86 or otherwise QTAgent.exe for x64 platform. The following may be recommended as well.

1
editbin /LARGEADDRESSAWARE "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"
editbin /LARGEADDRESSAWARE "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"

Setting an application (or DLL) to LAA-enabled is actually flagging a bit in PE header that tells OS that it might need memory up to 4GB, so under x64 OS, it can actually use up to 4GB but on x86 or some other system, it might use up to 3GB or 2GB depending on setting (e.g. PAE).

–EOF (The Ultimate Computing & Technology Blog) —

GD Star Rating
loading...
319 words
Last Post: Correctly Serving SSL Certificate for Multiple Domains on the Same Server if You have Multiple IPs
Next Post: Manage WordPress Connections, Settings in One Place for Multiple WordPress Sites on Same Domain

The Permanent URL is: MSTest – Out of Memory – LAA for 32-bit Test Agent

Leave a Reply