14 :
heap_(
heap), last_measured_at_(startup_time) {}
29 const size_t computed_limit =
38 constexpr size_t kMinHeapExtraSpace = 2 *
MB;
41 size_t new_limit = std::max<size_t>(minimum_limit, computed_limit);
45 if (
v8_flags.trace_memory_balancer) {
47 "MemoryBalancer: allocation-rate=%.1lfKB/ms gc-speed=%.1lfKB/ms "
48 "minium-limit=%.1lfM computed-limit=%.1lfM new-limit=%.1lfM\n",
51 static_cast<double>(minimum_limit) / MB,
52 static_cast<double>(computed_limit) / MB,
53 static_cast<double>(new_limit) / MB);
72 size_t major_allocation_bytes,
base::TimeDelta major_allocation_duration) {
89 const size_t allocated_bytes =
103 std::make_unique<HeartbeatTask>(
heap_->
isolate(),
this), 1);
void PostDelayedTask(std::unique_ptr< Task > task, double delay_in_seconds, const SourceLocation &location=SourceLocation::Current())
double InMillisecondsF() const
void SetOldGenerationAndGlobalAllocationLimit(size_t new_old_generation_allocation_limit, size_t new_global_allocation_limit)
size_t min_old_generation_size() const
size_t max_old_generation_size() const
V8_EXPORT_PRIVATE size_t OldGenerationSizeOfObjects() const
std::shared_ptr< v8::TaskRunner > GetForegroundTaskRunner(TaskPriority priority=TaskPriority::kUserBlocking) const
Isolate * isolate() const
void RunInternal() override
HeartbeatTask(Isolate *isolate, MemoryBalancer *mb)
size_t live_memory_after_gc_
MemoryBalancer(Heap *heap, base::TimeTicks startup_time)
std::optional< SmoothedBytesAndDuration > major_gc_speed_
static constexpr double kMajorAllocationDecayRate
void UpdateGCSpeed(size_t major_gc_bytes, base::TimeDelta major_gc_duration)
void RecomputeLimits(size_t embedder_allocation_limit, base::TimeTicks time)
size_t last_measured_memory_
base::TimeTicks last_measured_at_
void UpdateAllocationRate(size_t major_allocation_bytes, base::TimeDelta major_allocation_duration)
size_t embedder_allocation_limit_
std::optional< SmoothedBytesAndDuration > major_allocation_rate_
bool heartbeat_task_started_
static constexpr double kMajorGCDecayRate
V8_EXPORT_PRIVATE FlagValues v8_flags
too high values may cause the compiler to set high thresholds for inlining to as much as possible avoid inlined allocation of objects that cannot escape trace load stores from virtual maglev objects use TurboFan fast string builder analyze liveness of environment slots and zap dead values trace TurboFan load elimination emit data about basic block usage in builtins to this enable builtin reordering when run mksnapshot flag for emit warnings when applying builtin profile data verify register allocation in TurboFan randomly schedule instructions to stress dependency tracking enable store store elimination in TurboFan rewrite far to near simulate GC compiler thread race related to allow float parameters to be passed in simulator mode JS Wasm Run additional turbo_optimize_inlined_js_wasm_wrappers enable experimental feedback collection in generic lowering enable Turboshaft s WasmLoadElimination enable Turboshaft s low level load elimination for JS enable Turboshaft s escape analysis for string concatenation use enable Turbolev features that we want to ship in the not too far future trace individual Turboshaft reduction steps trace intermediate Turboshaft reduction steps invocation count threshold for early optimization Enables optimizations which favor memory size over execution speed Enables sampling allocation profiler with X as a sample interval min size of a semi the new space consists of two semi spaces max size of the Collect garbage after Collect garbage after keeps maps alive for< n > old space garbage collections print one detailed trace line in allocation gc speed threshold for starting incremental marking via a task in percent of available threshold for starting incremental marking immediately in percent of available Use a single schedule for determining a marking schedule between JS and C objects schedules the minor GC task with kUserVisible priority max worker number of concurrent for NumberOfWorkerThreads start background threads that allocate memory concurrent_array_buffer_sweeping use parallel threads to clear weak refs in the atomic pause trace progress of the incremental marking trace object counts and memory usage * MB