Compilation going out of memory

I wanted to run a webserver as escript similar to what erlang PL does, so it needs to embed all “files” inside the escript. I’ve now looked how they do it and do it differently, embedding the files in the escript .zip.

However my question still stands, the memory usage is quite surprising. @josevalim mentions something similar in this post however there it’s only about slowness of compilation, not the memory usage.