i found a neat trick which lets you take advantage of CoW to duplicate memory without allocating anything upfront. maybe some people already know about this, but i just discovered it and i think it's cool (and i kinda wish it was easier to take advantage of this with higher-level stdlib functions)