GitHub user queimadus added a comment to the discussion: Memory leak when using `flatMapPrefix`/`prefixAndTail` with `Concat`
Tested it with a very naive change, just to check if it would make any difference in the test example, and got no difference in heap behavior. Maybe too much of a naive change 😅 ```diff diff --git a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala index bf28108..aef5833 100755 --- a/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/scaladsl/Graph.scala @@ -1349,6 +1349,7 @@ final class Concat[T](val inputPorts: Int) extends GraphStage[UniformFanInShape[ } override def onUpstreamFinish() = { + connDelete(i) if (idx == activeStream) { activeStream += 1 // Skip closed inputs diff --git a/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala b/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala index b186308..e09f123 100644 --- a/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala +++ b/stream/src/main/scala/org/apache/pekko/stream/stage/GraphStage.scala @@ -483,6 +483,10 @@ abstract class GraphStageLogic private[stream] (val inCount: Int, val outCount: private def conn(in: Inlet[_]): Connection = portToConn(in.id) private def conn(out: Outlet[_]): Connection = portToConn(out.id + inCount) + def connDelete(in: Inlet[_]): Unit = { + portToConn(in.id) = null + println((portToConn.count(_ eq null), portToConn.size)) + } /** * Retrieves the current callback for the events on the given [[Outlet]] ``` GitHub link: https://github.com/apache/pekko/discussions/1566#discussioncomment-11639077 ---- This is an automatically sent email for notifications@pekko.apache.org. To unsubscribe, please send an email to: notifications-unsubscr...@pekko.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@pekko.apache.org For additional commands, e-mail: notifications-h...@pekko.apache.org