我想运行一个可执行文件并限制其内存和时间使用。当然 我想知道它是否违反了这些规定,如果没有,我想要 数据使用了多少。我可以使用 .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
祝你好运。
关于c# - 如何在时间和内存使用限制的情况下运行可执行文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1381275/