Fixes memory leaks on large imports
Merge branch 'gc-fix'