-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
Query Execution
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Overview
MemoryUsageLimit (src/mongo/db/memory_tracking/memory_usage_limit.h) is currently constructible only from a raw int64_t byte count. Test and production call sites express limits as magic numbers such as 100 * 1024 * 1024.
Suggested in review of SERVER-131006 (https://github.com/10gen/mongo/pull/58119): accept a MemorySize (src/mongo/db/query/util/memory_util.h) so call sites read as:
MemoryUsageTracker \_tracker{false, MemoryUsageLimit{MemorySize{"100MB"}}};
or, with a user-defined literal in the spirit of _sd:
MemoryUsageLimit{100\_mb}
Notes
* Keep the constructor explicit; the point of the type is that byte-count-to-limit conversions stay visible.
* Follow-up for post 9.0; no behavior change.