CPU and Memory Cap for an AppDomain
问题 I want to host an exe in an appdomain and assign a CPU and Memory cap to it so that it does not use more than the assigned processing power. Is this possible to do and how? 回答1: You can't cap the maximum memory directly, as far as I know. However, from .NET 4 on, the memory currently allocated by an AppDomain is available in the AppDomain.MonitoringSurvivedMemorySize property if AppDomain.MonitoringIsEnabled is set to true . You can spin up a watchdog thread to monitor allocations. 回答2: Looks