at macos this function /seemed/ to massively leak, when looking at the valgrind output on macos (but not linux). with this update, this leak(?) is gone.