I am new to powershell, but have written several scripts running on a windows2003 server. This is definitely more powerful than cmd scripts (possibly due to the fact that I have a programming background). However, as I delve deeper, I noticed that:
- Each running script will run under one powershell process, i.e. you see a new powershell process for each script.
- the scripts that I tested for memory are really simple, say, build a string or request an environment variable, then Start-Sleep for 60 sec, so nothing is needed (as for using memory). But each process is about 30 MB. Call me stingy, but since there is an intensive amount of application memory that needs to be executed every day, and if I need to schedule several powershell scripts for regular work and maybe some scripts constantly working as a service, I would certainly try to save memory consumption as possible less. <- This is because we recently experienced a large application crash due to lack of memory.
I haven't touched C # yet, but would anyone think it might sometimes be better to write a task in C #?
Meanwhile, I saw a memory leak message in powershell. Do I believe that the memory created by the script will contain the powershell process space, so when the script exits, so powershell ends, the created memory is cleared?
source
share