V3 Documentation

Test Process Memory Limit

Global-level NCrunch configuration setting Default Value: 0


This configuration setting defines a memory utilisation limit for test processes executed by NCrunch. The limit is specified as the maximum number of bytes allowed to be allocated by a test process before the process is marked for automatic recycling by NCrunch.

This setting exists as a way to limit the impact of memory leaks that exist within test code or code under test.


Memory limits are only enforced passively and will not result in any test process being interrupted. When a test run completes, NCrunch will inspect the amount of memory still allocated by the process. If the memory utilisation exceeds the limit, the test process will be terminated to prevent it from being later re-used by the engine. This means it is still possible for test processes to temporarily exceed the memory limit without being marked for recycling, provided their memory utilisation is below the limit when the test run has been completed.

Setting the value for this configuration setting to 0 will disable the memory limit.


This configuration setting is useful when using NCrunch on large solutions in memory constrained environments. Setting the memory limit to a sensible value can prevent accumulated leaks from causing OutOfMemoryExceptions during test runs.