+1 for something like this. I asked about this here as well: https://discourse.julialang.org/t/is-there-a-way-cap-memory-usage-to-keep-mybinder-from-crashing
Fwiw, I found that using package compiler helped reduce the memory footprint when loading packages.