Fix PermGen error when running a big script