Hi Alexander,
Which Mathematica version do you use? I have tried your code with version 10.3 and got a couple of errors. During the run, the memory used by the FrontEnd grows up to 400 Mb what I would consider as a memory leak similar to this one. But I don't get the "not enough memory" message on my laptop with 8 Gb of RAM running Windows 7 x64.
The Kernel <-> FrontEnd communication during rasterization of the Graphics expressions (which you perform by applying Binarize) is the bottleneck which results in your code being slow. You can speed up your code and avoid the memory leak if you Rasterize your digits not one-by-one (as you currently do) but for example 1000 digits at one time.