DEFINE_INT(max_old_space_size, 0, "max size of the old space (in Mbytes)")
DEFINE_INT(initial_old_space_size, 0, "initial old space size (in Mbytes)")
DEFINE_INT(max_executable_size, 0, "max size of executable memory (in Mbytes)")
+DEFINE_INT(shrink_new_space_to_initial_capacity, 0,
+ "shrink new space to initial capacity")
DEFINE_BOOL(gc_global, false, "always perform global GCs")
DEFINE_INT(gc_interval, -1, "garbage collect after <n> allocations")
DEFINE_INT(retain_maps_for_n_gc, 2,
void NewSpace::Shrink() {
int new_capacity = Max(InitialTotalCapacity(), 2 * SizeAsInt());
+ //Overwrite new_capacity to shrink to initial capacity
+ //if shrink_new_space_to_initial_capacity flag is set
+ if (FLAG_shrink_new_space_to_initial_capacity)
+ new_capacity = InitialTotalCapacity();
int rounded_new_capacity = RoundUp(new_capacity, Page::kPageSize);
if (rounded_new_capacity < TotalCapacity() &&
to_space_.ShrinkTo(rounded_new_capacity)) {