on master help sign in
Fix slidingWindow
b209502Anurag Hooda
src/Streamly/Internal/Data/Ring/Foreign.hs+2
@@ -538,6 +538,7 @@ slidingWindow n (Fold step1 initial1 extract1)= Fold step initial extract
538 step (Tuple4' rb rh i st) a
538 step (Tuple4' rb rh i st) a
539 | i < n = do
539 | i < n = do
540 rh1 <- liftIO $ unsafeInsert rb rh a
540 rh1 <- liftIO $ unsafeInsert rb rh a
541+ liftIO $ touchForeignPtr (ringStart rb)
541 r <- step1 st (a, Nothing)
542 r <- step1 st (a, Nothing)
542 return $
543 return $
543 case r of
544 case r of
@@ -546,6 +547,7 @@ slidingWindow n (Fold step1 initial1 extract1)= Fold step initial extract
546 | otherwise = do
547 | otherwise = do
547 old <- liftIO $ peek rh
548 old <- liftIO $ peek rh
548 rh1 <- liftIO $ unsafeInsert rb rh a
549 rh1 <- liftIO $ unsafeInsert rb rh a
550+ liftIO $ touchForeignPtr (ringStart rb)
549 r <- step1 st (a, Just old)
551 r <- step1 st (a, Just old)
550 return $
552 return $
551 case r of
553 case r of