[英]How to run an executable with time and memory usage limit?
我想运行一个可执行文件并限制其内存和时间使用。 当然,我想知道它是否违反了这些规定,如果不是,我希望数据使用了多少。 我可以从.NET使用什么来做到这一点?
您可以使用线程来监视您运行的可执行文件。
var process = Process.Start("Test.exe");
// Monitor - Use this property to monitor the memory
process.MainModule.ModuleMemorySize
// Monitor - Use this property to monitor the time
process.StartTime
// Limit - You can use this property to limit the executable memory size,
// but I wouldn't recommend it...
process.MaxWorkingSet
祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.