// Copyright 2023 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_HEAP_MEMORY_BALANCER_H_ #define V8_HEAP_MEMORY_BALANCER_H_ #include <optional> #include "src/base/platform/time.h" #include "src/tasks/cancelable-task.h" namespace v8 { namespace internal { class Heap; // The class that implements memory balancing. // Listen to allocation/garbage collection events // and smooth them using an exponentially weighted moving average (EWMA). // Spawn a heartbeat task that monitors allocation rate. // Calculate heap limit and update it accordingly. class MemoryBalancer { … }; class HeartbeatTask : public CancelableTask { … }; } // namespace internal } // namespace v8 #endif // V8_HEAP_MEMORY_BALANCER_H_