From 988e39b5d18fab2111aec061319d121b3de067dd Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 9 Dec 2022 14:40:22 -0800 Subject: [PATCH] [resource_quota] Apply fixes for memory pressure controller (#31860) --- src/core/lib/resource_quota/memory_quota.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/core/lib/resource_quota/memory_quota.h b/src/core/lib/resource_quota/memory_quota.h index 068fca30642..c8cd6c1ff92 100644 --- a/src/core/lib/resource_quota/memory_quota.h +++ b/src/core/lib/resource_quota/memory_quota.h @@ -291,12 +291,12 @@ class BasicMemoryQuota final // Data about current memory pressure. struct PressureInfo { // The current instantaneously measured memory pressure. - double instantaneous_pressure; + double instantaneous_pressure = 0.0; // A control value that can be used to scale buffer sizes up or down to // adjust memory pressure to our target set point. - double pressure_control_value; + double pressure_control_value = 0.0; // Maximum recommended individual allocation size. - size_t max_recommended_allocation_size; + size_t max_recommended_allocation_size = 0; }; explicit BasicMemoryQuota(std::string name) : name_(std::move(name)) {} @@ -530,6 +530,7 @@ class MemoryOwner final : public MemoryAllocator { // Instantaneous memory pressure in the underlying quota. BasicMemoryQuota::PressureInfo GetPressureInfo() const { + if (!is_valid()) return {}; return impl()->GetPressureInfo(); }