diff --git a/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.cc b/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.cc index f71a4b8e1a823da3ce6ec57fd39e21aa94a306a7..8cd7335cf4fa6dac77233b49c06053f4dc4190e6 100644 --- a/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.cc +++ b/paddle/fluid/memory/allocation/auto_growth_best_fit_allocator.cc @@ -27,7 +27,7 @@ DEFINE_bool(free_idle_chunk, false, "allocation request. If true, no allocation would be cached. This " "flag only works when FLAGS_allocator_strategy=auto_growth."); -DEFINE_bool(free_when_no_cache_hit, true, +DEFINE_bool(free_when_no_cache_hit, false, "Whether to free idle chunks when no cache hit. If true, idle " "chunk would be freed when no cache hit; if false, idle " "chunk would be freed when out of memory occurs. This flag " diff --git a/paddle/fluid/platform/flags.cc b/paddle/fluid/platform/flags.cc index 9b5e0c92fca470cad82191f41500120cecdf7f6f..f916567d99b1628443329744059194f0418997d5 100644 --- a/paddle/fluid/platform/flags.cc +++ b/paddle/fluid/platform/flags.cc @@ -307,7 +307,12 @@ DEFINE_double(memory_fraction_of_eager_deletion, 1.0, * Example: * Note: For selecting allocator policy of PaddlePaddle. */ -DEFINE_string(allocator_strategy, "naive_best_fit", +#ifdef PADDLE_ON_INFERENCE +static constexpr char kDefaultAllocatorStrategy[] = "naive_best_fit"; +#else +static constexpr char kDefaultAllocatorStrategy[] = "auto_growth"; +#endif +DEFINE_string(allocator_strategy, kDefaultAllocatorStrategy, "The allocation strategy. naive_best_fit means the original best " "fit allocator of Fluid. " "auto_growth means the experimental auto-growth allocator. "