Were you out of your mind? Open the task manager and observe how much consumed memory is increased.
Well here the script uses no more than 10MB memory before it crahes. So i assumed the crash is caused by the recusrsion and not by excessive memory usage.
255!
I am aware that final memory usage would exceed any physical possible amount. And i was prepared for a crash later on, but here it crashes instantly; it does not even pass through to the end of the first recursion which should only only use about 40MB if i estimate it right.
i modified the script a bit, so it does not keep the results in memory. But it still crashes almost instantly, it seems it does only reach a recursion-depth of 85 and crash with a memory use of around 7.8 MB:
SetBatchlines -1
#NoEnv
loop, 255
baselist .= Chr(A_Index)
makelists(baselist, "")
Tooltip
Listvars
MsgBox Done. %list_idx% strings created.
makelists(baselist, newlist)
{
loop, parse, baselist
{
global rec_depth
thischar := A_Loopfield
StringReplace, newbaselist, baselist, %thischar%,, All
new_newlist := newlist . thischar
if (newbaselist = "")
{
rec_depth := 0
Tooltip, %rec_depth%, 0, 40, 2
newlist(new_newlist)
}
else
{
rec_depth ++
Tooltip, %rec_depth%, 0, 40, 2
makelists(newbaselist, new_newlist)
}
}
return
}
newlist(newlist)
{
global list_idx
SetFormat, float, 3.0
list_idx ++
MsgBox % newlist
tooltip %list_idx%, 0, 0, 1
return
}
I´m still clueless.
btw: the point of all this was to try an brute-force attack on the encryption
this script from nick provides.
Edit: i created a much simpler recursive function that does not bloat the memory that much just for testing:
MsgBox % rec(0, 1000)
return
rec(deep, end)
{
Tooltip %deep%
if (deep = end)
return "done"
else
return rec(deep + 1, end)
}
it crashes at 662 recursions.