Skip to content

Commit 9cf04d5

Browse files
committed
colexec: batch allocations of BoundAccount
Allocations of `BoundAccount`s in `createUnlimitedMemAccountsLocked` are now batched into a single allocation. Release note: None
1 parent 61b6ac4 commit 9cf04d5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkg/sql/colexec/colexecargs/monitor_registry.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,10 @@ func (r *MonitorRegistry) createUnlimitedMemAccountsLocked(
167167
)
168168
r.monitors = append(r.monitors, bufferingOpUnlimitedMemMonitor)
169169
oldLen := len(r.accounts)
170-
for i := 0; i < numAccounts; i++ {
171-
acc := bufferingOpUnlimitedMemMonitor.MakeBoundAccount()
172-
r.accounts = append(r.accounts, &acc)
170+
newAccounts := make([]mon.BoundAccount, numAccounts)
171+
for i := range newAccounts {
172+
newAccounts[i] = bufferingOpUnlimitedMemMonitor.MakeBoundAccount()
173+
r.accounts = append(r.accounts, &newAccounts[i])
173174
}
174175
return bufferingOpUnlimitedMemMonitor, r.accounts[oldLen:len(r.accounts)]
175176
}

0 commit comments

Comments
 (0)