ioFeat contains a call to mapM with a potentially very long list, which leads to a space leak, as the result list is retained until the end of the computation.
You can demonstrate the problem by executing the following code:
module Main where
import Test.Feat
main = featCheck 45 ((\_ -> True) :: [Bool] -> Bool)
With the current version of testing-feat, the code requires over 200MB of memory, whereas only 2 MB is consumed if we replacemapM with mapM_ in ioFeat, as proposed in this PR.
ioFeat
contains a call tomapM
with a potentially very long list, which leads to a space leak, as the result list is retained until the end of the computation.You can demonstrate the problem by executing the following code:
With the current version of testing-feat, the code requires over 200MB of memory, whereas only 2 MB is consumed if we replace
mapM
withmapM_
inioFeat
, as proposed in this PR.