Skip to content

Commit 5dd4ae2

Browse files
resolve merge conflicts and update memory tracking guidelines
1 parent d179eed commit 5dd4ae2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

common/types/memory_tracker.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ func MemoryTrackerSizeCalculator(calc *SizeCalculator) MemoryTrackerOption {
5959
// arithmetic saturating at math.MaxUint32. The tracker is independent of any interpreter
6060
// implementation; evaluators feed it observations at points where values materialize:
6161
//
62-
// - inputs to a call (e.g. the target and arguments of a.join(', '))
63-
// - the output of a call (e.g. the result of a + a)
62+
// - inputs and outputs of calls (e.g. the target and arguments of a.join(', '))
6463
// - resolved attribute values (e.g. the value of a.b.c)
65-
// - sampled values built up within comprehensions or bind initializers
64+
// - values built up within literal blocks, comprehensions, and bind initializers
6665
//
6766
// The peak is the largest single observation, where one Track call observes a set of
6867
// coexistent values as a single watermark.
@@ -106,6 +105,9 @@ func (t *MemoryTracker) Version() int {
106105
//
107106
// Call sites with multiple live values, such as the input arguments to a function call,
108107
// should be tracked in a single call so the watermark reflects their combined footprint.
108+
//
109+
// Within observers, consider whether to choose the aggregated argument sizes, the result size,
110+
// or both when working with allocating operations.
109111
func (t *MemoryTracker) Track(vals ...any) uint32 {
110112
total := uint32(0)
111113
for _, val := range vals {

0 commit comments

Comments
 (0)