Commit b2750260 authored by Simon Marlow's avatar Simon Marlow

add test for #4334 (space leak in Data.List.lines)

parent f1564fa2
module Main (main) where
import System.Environment (getArgs)
mkText :: Int -> Int -> Char -> String
mkText ll ln c =
unlines $ [replicate k c | k <- [ll .. ll+ln]]
main :: IO ()
main = do
args <- getArgs
let (ll, ln, c) =
case args of
(a1:a2:a3:_) -> (read a1, read a2, head a3)
(a1:a2:_) -> (read a1, read a2, 'a')
(a1:_) -> (read a1, 3, 'b')
_ -> (100000, 5, 'c')
mapM_ (print . length) (lines $ mkText ll ln c)
......@@ -21,3 +21,11 @@ test('space_leak_001',
compile_and_run,
[''])
test('T4334',
# Test for a space leak in Data.List.lines (fixed with #4334)
[extra_run_opts('1000000 2 t'),
stats_num_field('peak_megabytes_allocated', 1, 3),
# prof ways don't work well with +RTS -V0
omit_ways(['profc','profasm','profthreaded'])
],
compile_and_run, [''])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment