diff --git a/copy/apm-data/input/elasticapm/processor.go b/copy/apm-data/input/elasticapm/processor.go index 0994687acdf..c7c5eaed735 100644 --- a/copy/apm-data/input/elasticapm/processor.go +++ b/copy/apm-data/input/elasticapm/processor.go @@ -321,11 +321,6 @@ func (p *Processor) handleStream( // processBatch processes the batch and returns the events to the pool after it's been processed. func (p *Processor) processBatch(ctx context.Context, processor modelpb.BatchProcessor, batch *modelpb.Batch) error { - defer func() { - for i := range *batch { - (*batch)[i].ReturnToVTPool() - } - }() return processor.ProcessBatch(ctx, batch) } diff --git a/x-pack/apm-server/sampling/processor.go b/x-pack/apm-server/sampling/processor.go index 94b3ae3df99..8828624868a 100644 --- a/x-pack/apm-server/sampling/processor.go +++ b/x-pack/apm-server/sampling/processor.go @@ -545,11 +545,6 @@ func (p *Processor) Run() error { if err := p.config.BatchProcessor.ProcessBatch(gracefulContext, &events); err != nil { p.logger.With(logp.Error(err)).Warn("failed to report events") } - - for i := range events { - events[i].ReturnToVTPool() - events[i] = nil // not required but ensure that there is no ref to the freed event - } } } })