Preventing/handling space leaks