Release extraction intermediates after their last consumers
This commit is contained in:
@@ -80,6 +80,10 @@ func (r *Runner) runLanes(parent context.Context, input RunInput, step PreparedP
|
||||
groups = append(groups, state.completedGroups[index]...)
|
||||
}
|
||||
completedOutputs[lane].diagnosticGroups = append(groups, completedOutputs[lane].diagnosticGroups...)
|
||||
// All dispatched jobs have drained; incomplete values cannot be consumed.
|
||||
state.completedGroups = nil
|
||||
state.results = nil
|
||||
state.values = nil
|
||||
}
|
||||
mergeCompletedLanes(&output, completedOutputs)
|
||||
if err := selectRunError(parent, runErrors); err != nil {
|
||||
@@ -263,6 +267,9 @@ func (e *laneEngine) handleExtractResult(result extractJobResult) {
|
||||
}
|
||||
|
||||
func (e *laneEngine) handleCompletion(completion laneCompletion) {
|
||||
// The worker has returned, so merge, normalization, and capture no longer
|
||||
// borrow this lane's extraction values even if a sibling is still running.
|
||||
e.states[completion.index].values = nil
|
||||
e.completedOutputs[completion.index] = completion.output
|
||||
if completion.err != nil {
|
||||
e.runErrors = append(e.runErrors, classifyLaneError(completion.index, len(e.chunks), completion.err))
|
||||
@@ -342,6 +349,8 @@ func finalizeLaneExtract(state *laneExtractState) {
|
||||
state.fallbackCount++
|
||||
}
|
||||
}
|
||||
// Ordered values now own the needed references; the reorder map is redundant.
|
||||
state.results = nil
|
||||
}
|
||||
|
||||
func (r *Runner) continueLane(ctx context.Context, input RunInput, doc *source.SourceDocument, sourceInput contracts.LLMInputMaterial, sessionID string, chunks []source.Chunk, state *laneExtractState) (laneOutput, error) {
|
||||
|
||||
Reference in New Issue
Block a user