Exactly like Coder-san said. What is the
logic behind this? What makes you think that this will work the way you describe it?
If you look at the documentation:
http://ns7.webmasters.com/caspdoc/html/v...nction.htm
Then this creates a string in the memory containing spaces, which are characters. If one character is represented by one byte, then 10240000000 of them is going to take about 9.5 GB of memory, if it even allows you to make string that long. So... essentially you want to free memory by using it all?
Now I guess you ran it, it tried to allocate a lot of memory, meaning it expanded in memory and once it was done, it disappeared from it, leaving a large gap, so you thought "oh, it freed the memory". But the truth is actually the opposite - it forced other stuff from the memory to be written to the harddrive to the swap file, to make more space for your program to expand.
And harddrive is way slower than RAM, meaning now all the stuff has to be slowly loaded back to the memory, which is going to take some time. So in fact, it actually slows down the computer.
There's no real cleaning involved.
Or maybe you thought if you name the variable that stores the reference to the string FreeMem, it will make it free that amount of memory?
The language doesn't work that way. Try naming it AmountOfCashInMyWallet and see how will that work. Language doesn't generally care what you name your variables, that's just for you, the programmer, to better know what they store, which in this case is a lot of places.
Simply put:
This code doesn't work, it doesn't clean your memory, it will only slow your computer down.
Also what I find a bit sad is how many people respond thanking for this and such, without even thinking about it for a second. I mean... doesn't anybody use their brain here before responding?
For gravitons sake people - think for a second before posting, otherwise you're only making yourself look stupid.
EDIT: Also it's not really via notepad. That's just a tool for editing plaintext and does nothing on its own, other than allowing you to create plain text files, which could be technically almost any programming language, so with no context, it's not possible to determine that it's actually a VBscript, unless you're a seer.
It's about the same as if you wrote a shopping list on a paper and gave it to someone, who would then go to a store and buy the things you instructed him to. Who's the one who's shopping? The person or the piece of paper and the pen?