I'm writing a little PerformanceTest programm and I try to artificially restrcit the memory that can be used during the test. Some of the tests taking some hours to run while processing multiresolution images up to some 100 GB.
Ideal would be to set the restrictions per thread but I think this will not work. The tests are executed in a separate process or in a separate AppDomain. I know how to monitor (but not restrict) the resources of an AppDomain with ARM and ETW and I have tried to set the MaxWorkingSet on process level but this has no effect until the systems memory is under pressure.
Of cause, there are other ways and workarounds to accomplish this e.g by running the tests in a VM or restricting windows memory on boot options. Starting a second process that allocates huge amount of memory.
Is there any way to artifically restict the pysical memory a process/AppDomain can use even if there is free physical memory available on the system? May be it is posible to restrict the virtual memory too?