on master help sign in
Fix space leak in async combinator
947d6ccHarendra Kumar
Changelog.md+7−3
@@ -3,9 +3,13 @@
3### Bug Fixes
3### Bug Fixes
4
4
5* Fix a bug that caused `findIndices` to return wrong indices in some
5* Fix a bug that caused `findIndices` to return wrong indices in some
6−pipelines
6+ cases.
7−
7+* Fix a bug in `tap` that caused memory consumption to increase in some cases.
8−* Fix a bug in `tap` that sometimes increased memory consumption.
8+* Fix a space leak in `async` streams that caused memory consumption
9+ to increase with the number of elements in the stream, especially when
10+ built with `-threaded` and used with `-N` RTS option. The issue occurs
11+ only in cases when a worker thread happens to be used continuously for a
12+ long time.
9
13
10## 0.7.0
14## 0.7.0
11
15
src/Streamly/Internal/Data/Stream/Async.hs+4−4
@@ -95,7 +95,7 @@ workLoopLIFO q st sv winfo = run
95 yieldk a r = do
95 yieldk a r = do
96 res <- liftIO $ sendYield sv winfo (ChildYield a)
96 res <- liftIO $ sendYield sv winfo (ChildYield a)
97 if res
97 if res
98− then foldStreamSVar sv st yieldk single run r
98+ then foldStreamShared st yieldk single run r
99 else liftIO $ do
99 else liftIO $ do
100 enqueueLIFO sv q r
100 enqueueLIFO sv q r
101 sendStop sv winfo
101 sendStop sv winfo
@@ -155,7 +155,7 @@ workLoopLIFOLimited q st sv winfo = run
155 yieldLimitOk <- liftIO $ decrementYieldLimit sv
155 yieldLimitOk <- liftIO $ decrementYieldLimit sv
156 let stop = liftIO (incrementYieldLimit sv) >> run
156 let stop = liftIO (incrementYieldLimit sv) >> run
157 if res && yieldLimitOk
157 if res && yieldLimitOk
158− then foldStreamSVar sv st yieldk single stop r
158+ then foldStreamShared st yieldk single stop r
159 else liftIO $ do
159 else liftIO $ do
160 incrementYieldLimit sv
160 incrementYieldLimit sv
161 enqueueLIFO sv q r
161 enqueueLIFO sv q r
@@ -196,7 +196,7 @@ workLoopFIFO q st sv winfo = run
196 yieldk a r = do
196 yieldk a r = do
197 res <- liftIO $ sendYield sv winfo (ChildYield a)
197 res <- liftIO $ sendYield sv winfo (ChildYield a)
198 if res
198 if res
199− then foldStreamSVar sv st yieldk single run r
199+ then foldStreamShared st yieldk single run r
200 else liftIO $ do
200 else liftIO $ do
201 enqueueFIFO sv q r
201 enqueueFIFO sv q r
202 sendStop sv winfo
202 sendStop sv winfo
@@ -237,7 +237,7 @@ workLoopFIFOLimited q st sv winfo = run
237 yieldLimitOk <- liftIO $ decrementYieldLimit sv
237 yieldLimitOk <- liftIO $ decrementYieldLimit sv
238 let stop = liftIO (incrementYieldLimit sv) >> run
238 let stop = liftIO (incrementYieldLimit sv) >> run
239 if res && yieldLimitOk
239 if res && yieldLimitOk
240− then foldStreamSVar sv st yieldk single stop r
240+ then foldStreamShared st yieldk single stop r
241 else liftIO $ do
241 else liftIO $ do
242 incrementYieldLimit sv
242 incrementYieldLimit sv
243 enqueueFIFO sv q r
243 enqueueFIFO sv q r