diff --git a/src/proto/streams/prioritize.rs b/src/proto/streams/prioritize.rs index 14b37e223..68ce9c571 100644 --- a/src/proto/streams/prioritize.rs +++ b/src/proto/streams/prioritize.rs @@ -528,6 +528,11 @@ impl Prioritize { tracing::trace!("poll_complete"); loop { + // Create a new span at the start of the loop to avoid continuously + // adding events to the same span due to tracing in the loop, which + // would lead to an ongoing increase in memory usage. + let _span = tracing::debug_span!("poll_complete_loop").entered(); + if let Some(mut stream) = self.pop_pending_open(store, counts) { self.pending_send.push_front(&mut stream); self.try_assign_capacity(&mut stream);