Skip to content

Commit cf3fcec

Browse files
craig[bot]michae2
andcommitted
Merge #144118
144118: memo: release replacer closure during Memo.Detach r=mgartner a=michae2 In #120875 we added a replacer closure to the memo, so that we could call back into `norm.Factory.Replace` from within `statisticsBuilder.factorOutVirtualCols`, which only has access to the memo and not the factory. This closure, however, means that the memo could potentially prevent GC of, or have an invalid reference to the factory after detachment. We shouldn't need to run the statistics builder on this memo after detaching from the factory (we shouldn't be constructing any new expressions in it) so let's go ahead and release the reference. Epic: None Release note: None Co-authored-by: Michael Erickson <[email protected]>
2 parents ac8745d + f4fbd01 commit cf3fcec

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pkg/sql/opt/memo/memo.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,8 @@ func (m *Memo) NextRoutineResultBufferID() RoutineResultBufferID {
628628
// constructed in this memo.
629629
func (m *Memo) Detach() {
630630
m.interner = interner{}
631+
m.replacer = nil
632+
631633
// It is important to not hold on to the EvalCtx in the logicalPropsBuilder
632634
// (#57059).
633635
m.logPropsBuilder = logicalPropsBuilder{}

0 commit comments

Comments
 (0)