@@ -20,6 +20,16 @@ import System.Process
20minBytesAllowed, resetThreshold, maxBytesAllowed :: Int64
20minBytesAllowed, resetThreshold, maxBytesAllowed :: Int64
21(minBytesAllowed, resetThreshold, maxBytesAllowed) = (200000, 400000, 490000)
21(minBytesAllowed, resetThreshold, maxBytesAllowed) = (200000, 400000, 490000)
23+-- Some times the memory usage might flair up and then then return to normal
24+-- this probably indicates an issue, but if you are trying to fix a slow consistent
25+-- leak it can confuse the results by making the tests fail when the slow leak is
27+-- Set this limit to say how many failures (currentBytesUsed > maxBytesAllowed)
28+-- want to ignore. If the memory usage goes back under resetThreshold
29+-- the failure count is reset to 0.
23main :: IO ()
33main :: IO ()
25 mainThread <- myThreadId
35 mainThread <- myThreadId
@@ -48,10 +58,13 @@ main = do
48 finishTest $ ExitFailure 2
58 finishTest $ ExitFailure 2
49 let overMax = currentBytesUsed gcStats > maxBytesAllowed
59 let overMax = currentBytesUsed gcStats > maxBytesAllowed
50 underReset = currentBytesUsed gcStats < resetThreshold
60 underReset = currentBytesUsed gcStats < resetThreshold
51− when (overMax && failures > 4) $ do
61+ when (overMax && failures >= failureLimit) $ do
52 putStrLn "FAILED: currentBytesUsed > maxBytesAllowed"
62 putStrLn "FAILED: currentBytesUsed > maxBytesAllowed"
53 finishTest $ ExitFailure 1
63 finishTest $ ExitFailure 1
54− return $ Just (if overMax then succ failures else (if underReset then 0 else failures), succ n)
67+ else (if underReset then 0 else failures), succ n)
55 else do putStrLn "SUCCEEDED"
68 else do putStrLn "SUCCEEDED"
56 finishTest ExitSuccess
69 finishTest ExitSuccess
57 return Nothing
70 return Nothing