After further testing, I'm fairly sure this is an mIRC leak.
Using the following executed under cscript, the memory increases during the while loop but as soon as the loop finishes, the memory is freed; this doesn't appear to be the case with the previous posts' mIRC example
Save as leaktest.js
Open taskmanager (or any other tool to view memory usage)
Open cmd.exe
Navigate to the directory you saved leaktest.js
Input: cscript.exe leaktest.js
In the prompt, enter: 10000
WScript.StdOut.Write("How many times to iterate? ");
WScript.StdIn.Read(0);
var x = WScript.StdIn.ReadLine();
var js = '(function(){return{"test":Array(3001).join("a")}})()';
var leakTest, leakTestRes;
// creates an instance of scriptcontrol and sets the language
leakTest = new ActiveXObject("MSScriptControl.ScriptControl");
leakTest.language = "jscript";
while (x) {
x -= 1;
// calls the js function as the mSL code did
leakTestRes = leakTest.eval(js);
}
WScript.StdOut.Write("Press enter to exit...");
WScript.StdIn.Read(0);
WScript.StdIn.ReadLine();
EditAnd another test that doesn't use jscript at all pulled from the helpfile -- (but modified to show issue). Though not as significant as my previous two examples this one also shows an increase in memory without freeing once the com is closed (My guess is something to do with dispatching):
;; /cpu 10000
alias cpu {
var %Error, %x = $$1
comopen Locator WbemScripting.SWbemLocator
if ($comerr) {
%Error = Failed to open instance
}
else {
while (%x) {
dec %x
if ($com(Locator, ConnectServer, 3, dispatch* Services) && !$comerr && $com(Services)) {
.comclose services
}
else {
%Error = Failed to dispatch services
break
}
}
}
:error
if ($com(Services)) comclose Services
if ($com(Locator)) comclose Locator
if (%Error) {
echo -a $v1
}
elseif (!$error) {
echo -a Done!
}
}