I sometimes have scripts which are eating up all the memory. Since I don't want to monitor them all the time or set cpu priority to low manually I am wondering if there is an option to give that specific script a value (maybe in mb) of memory. Does this option exist?
相关问题
- What uses more memory in c++? An 2 ints or 2 funct
- How to Debug/Register a Permanent WMI Event Which
- How can I do variable substitution in a here-strin
- Achieving the equivalent of a variable-length (loc
- How to use a default value with parameter sets in
相关文章
- 在vscode如何用code runner打开独立的控制台窗口,以及设置好调试模式时窗口的编码?
- C#调用PowerShell的问题
- EscapeDataString having differing behaviour betwee
- Is there a non-java, cross platform way to launch
- PowerShell Change owner of files and folders
- Command line escaping single quote for PowerShell
- Is there a simple way to pass specific *named* Pow
- How do I access an element with xpath with a names
PowerShell doesn't provide any built-in way to control system resources like the memory used by a script.
Windows does provide a way to limit system resources to groups of processes, you can learn more about that here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms684161(v=vs.85).aspx
If your scripts are consuming too much memory, I'd suggest investigating the memory leak. There are many tools that help track memory leaks. Some are low level (e.g. using !dumpheap from SOS in windbg - http://msdn.microsoft.com/en-us/library/bb190764(v=vs.110).aspx). Others are pretty smart, letting you take multiple snapshots and show you just the newly allocated objects between the snapshots. You can search for ".Net memory profiler" to get an idea of what's available.