![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Memory usage for Cscript I have a script I wrote that basically performs a loop indefinably using wscript.sleep. The script performs the same action over and over again every 10 minutes. What is interesting to me however; if I fire the script off using cscript.exe it initially uses about 8MB or ram (as shown in the task manager). After the script has been running 4 - 5 days I checked again and it's using 500k. It seems strange to me that this would happen. Is this normal behavior? |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Memory usage for Cscript "Bob Smith" <BobSmith@xxxxxx> wrote in message news:B93BD40F-4994-488B-8A24-E5C77ABC55E0@xxxxxx Quote: >I have a script I wrote that basically performs a loop indefinably using > wscript.sleep. The script performs the same action over and over again > every > 10 minutes. What is interesting to me however; if I fire the script off > using > cscript.exe it initially uses about 8MB or ram (as shown in the task > manager). After the script has been running 4 - 5 days I checked again and > it's using 500k. It seems strange to me that this would happen. Is this > normal behavior? This should be considered normal behaviour for a script that consumes memory by REDIM'ing arrays, creating unnecessary objects, or doing some sort of string concatenation that does not properly release memory. What, precisely is your script doing? If short, try posting it here. /Al |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Memory usage for Cscript I would refer to this script as more like an application than a script. I like to push VB script to it's limits. Yes I do have arrays that I redim, I also have Many objects that perform differing tasks (open CDO mailboxes with CDO, send emails, open databases etc). It's probably not the cleanest code, but it gets the job done. I will not post the code as it is very long and not well documented. "Al Dunbar" wrote: Quote: > > "Bob Smith" <BobSmith@xxxxxx> wrote in message > news:B93BD40F-4994-488B-8A24-E5C77ABC55E0@xxxxxx Quote: > >I have a script I wrote that basically performs a loop indefinably using > > wscript.sleep. The script performs the same action over and over again > > every > > 10 minutes. What is interesting to me however; if I fire the script off > > using > > cscript.exe it initially uses about 8MB or ram (as shown in the task > > manager). After the script has been running 4 - 5 days I checked again and > > it's using 500k. It seems strange to me that this would happen. Is this > > normal behavior? > That depends. > > This should be considered normal behaviour for a script that consumes memory > by REDIM'ing arrays, creating unnecessary objects, or doing some sort of > string concatenation that does not properly release memory. What, precisely > is your script doing? If short, try posting it here. > > /Al > > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Memory usage for Cscript "Bob Smith" <BobSmith@xxxxxx> wrote in message news:C797CC53-5638-4B87-BBDB-CCFC6FA5154F@xxxxxx Quote: >I would refer to this script as more like an application than a script. I > like to push VB script to it's limits. Yes I do have arrays that I redim, > I > also have Many objects that perform differing tasks (open CDO mailboxes > with > CDO, send emails, open databases etc). It's probably not the cleanest > code, > but it gets the job done. I will not post the code as it is very long and > not > well documented. The answer seems to lie in this sentence: "It's probably not the cleanest code, but it gets the job done". At some point you might find that your "unclean" code will start failing to get the job done or causing other problems because it is not cleaning up after itself by releasing resources it has taken control of. You could analyze your code looking for objects not set to nothing, objects whose methods allow resources to be released (i.e. .close), iterative text concatenation, and arrays redimmed ad infinitum, and address the specific issue in each case. Hopefully your script (er, I mean "application") is well enough structured that this can be done without radical surgery. Of course, even if you were to do this, it would not guarantee that your script would be free from resource issues. I don't know how good vbscript is at garbage collection. /Al Quote: > "Al Dunbar" wrote: > Quote: >> >> "Bob Smith" <BobSmith@xxxxxx> wrote in message >> news:B93BD40F-4994-488B-8A24-E5C77ABC55E0@xxxxxx Quote: >> >I have a script I wrote that basically performs a loop indefinably using >> > wscript.sleep. The script performs the same action over and over again >> > every >> > 10 minutes. What is interesting to me however; if I fire the script off >> > using >> > cscript.exe it initially uses about 8MB or ram (as shown in the task >> > manager). After the script has been running 4 - 5 days I checked again >> > and >> > it's using 500k. It seems strange to me that this would happen. Is this >> > normal behavior? >> That depends. >> >> This should be considered normal behaviour for a script that consumes >> memory >> by REDIM'ing arrays, creating unnecessary objects, or doing some sort of >> string concatenation that does not properly release memory. What, >> precisely >> is your script doing? If short, try posting it here. >> >> /Al >> >> >> |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Memory usage for Cscript As an alternative to investing a lot of time in cleaning up the code, why not make it a run-once application and use the windows task scheduler to re-invoke it on a schedule? That way it wouldn't get the chance to amass a lot of resources. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Memory usage | Vista General | |||
| Memory usage | Vista performance & maintenance | |||
| Memory Usage... | General Discussion | |||
| Memory Usage | Vista General | |||
| Memory Usage | Vista performance & maintenance | |||