Intruder said:
Infognition also recommends multi-threading: http://www.infognition.com/tutorials/rip_guides/avisynth.html
Just a quick writeup of your v10 with multi-threading, only three lines added hopefully make the deal. I have not tested it.
SetMemoryMax(2048) #I have enough memory
That's an incorrect use of SetMemoryMax and will cause problems. SetMemoryMax only controls the caching amount for each clip within the script, as Avisynth is 32bit it can't index beyond the 2GB limit imposed on 32bit applications (and that includes all 32 bit processes). Each time a new clip is created in the script more caching memory is allocated, your instruction could result in Avisynth trying to index around 22GB of RAM in total in DrDre's script.