Debugging compile time memory usage

Kamil Koczurek koczurekk at gmail.com
Sun Jun 24 14:16:26 UTC 2018


I recently wrote a brainfuck compiler in D, which loads the BF 
source at compile time, performs some (simple) optimizations, 
translates everything to D and puts it into the source code with 
a mixin.

I did manage to get some pretty good performance, but for some 
programs in brainfuck I have to use LDC instead of DMD because 
the latter runs out of memory. Is there a way for me to optimize 
my code in such a way that DMD will be able to compile it?

D code: https://pastebin.com/fg1bqwnd
BF program that works: 
https://github.com/erikdubbelboer/brainfuck-jit/blob/master/mandelbrot.bf
BF program that makes DMD crash: 
https://github.com/fabianishere/brainfuck/blob/master/examples/hanoi.bf

After putting BF code in code.bf and D in main.d, I compile it 
with the following command: dmd main.d -J./

Error msg: unable to fork: Cannot allocate memory
DMD version: DMD64 D Compiler v2.080.0-dirty


More information about the Digitalmars-d-learn mailing list