GitHub user queimadus added a comment to the discussion: Memory leak when using `flatMapPrefix`/`prefixAndTail` with `Concat`
Ran this code https://github.com/queimadus/pekko-leak-example with 100M of heap. Both tests using concat ran out of heap. Using the same inner source in all examples: ``` val s = Source .repeat(()) .map(_ => ByteString('a' * 400000)) .take(1000000) .flatMapPrefix(50000) { prefix => Flow[ByteString] } ``` ----------------------------------- ``` Source.empty .concatAllLazy(List.tabulate(30000)(_ => s): _*) .runWith(Sink.ignore).onComplete(println(_)) ``` <img width="1840" alt="Screenshot 2024-12-21 at 15 48 37" src="https://github.com/user-attachments/assets/1c35e3f9-0cee-4ab7-ba2b-3cb29787a3ef" /> <img width="1262" alt="Screenshot 2024-12-21 at 15 53 05" src="https://github.com/user-attachments/assets/10d93402-6a6b-475a-88f9-5fd8e6895bbd" /> ------------------------------- ``` Source .repeat(s) .take(30000) .flatMapConcat(x => x) .runWith(Sink.ignore) .onComplete(println(_)) ``` <img width="1296" alt="Screenshot 2024-12-21 at 15 52 27" src="https://github.com/user-attachments/assets/5f64fd09-fec9-48da-abaa-3f1612677243" /> <img width="1224" alt="Screenshot 2024-12-21 at 15 53 26" src="https://github.com/user-attachments/assets/b02fd74c-66fb-4188-8ba1-2a4051e3ccd7" /> ------------------------------- ``` Source.empty .concatAllLazy(List.tabulate(30000)(_ => Source.lazySource(() => s)): _*) .runWith(Sink.ignore).onComplete(println(_)) ``` <img width="1299" alt="Screenshot 2024-12-21 at 16 07 31" src="https://github.com/user-attachments/assets/092ceee8-963a-43ea-8cdd-636ffa5ca092" /> <img width="994" alt="Screenshot 2024-12-21 at 16 07 12" src="https://github.com/user-attachments/assets/666ea1ae-3b90-4ff3-ad15-5e0c8a43da62" /> GitHub link: https://github.com/apache/pekko/discussions/1566#discussioncomment-11638296 ---- 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