Added code to perform GC while loading.