Unfortunately the trick of passing the address to stdlib "free" causes a crash in WebGL, so we need to wrap these in lambda.