Control GC using flag