Carbon: Fix memory management