This is an automated email from the ASF dual-hosted git repository.

hepin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko.git


The following commit(s) were added to refs/heads/main by this push:
     new d34927b56b fix: Fix a leak in PrefixAndTail operator. (#1623)
d34927b56b is described below

commit d34927b56b2ecc06937cd668ece26515e49bee49
Author: He-Pin(kerr) <[email protected]>
AuthorDate: Fri Jan 3 21:46:40 2025 +0800

    fix: Fix a leak in PrefixAndTail operator. (#1623)
---
 .../scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala
 
b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala
index dc84291b2e..4c9b9cea7b 100644
--- 
a/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala
+++ 
b/stream/src/main/scala/org/apache/pekko/stream/impl/fusing/StreamOfStreams.scala
@@ -237,7 +237,9 @@ import pekko.util.ccompat.JavaConverters._
     override def onUpstreamFinish(): Unit = {
       if (!prefixComplete) {
         // This handles the unpulled out case as well
-        emit(out, (builder.result(), Source.empty), () => completeStage())
+        val prefix = builder.result();
+        builder = null // free for GC
+        emit(out, (prefix, Source.empty), () => completeStage())
       } else {
         if (!tailSource.isClosed) tailSource.complete()
         completeStage()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to