on develop help sign in
Add comment about resetThreshold to gc test code
commit3bd6bf81d5f6efa4bbbc415975d2300a3ea8ad96 authorHamish Mackenzie <Hamish.K.Mackenzie@googlemail.com> dateFri 23 Jun 2017, 00:28 (9 years ago) parent1177c3d
1 file changed+15−2
reflex-dom-core/test/gc.hs+15−2
reflex-dom-core/test/gc.hs+15−2
@@ -20,6 +20,16 @@ import System.Process
2020minBytesAllowed, resetThreshold, maxBytesAllowed :: Int64
2121(minBytesAllowed, resetThreshold, maxBytesAllowed) = (200000, 400000, 490000)
2222
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
26+-- fixed.
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.
30+failureLimit :: Int
31+failureLimit = 0
32+
2333main :: IO ()
2434main = do
2535 mainThread <- myThreadId
@@ -48,10 +58,13 @@ main = do
4858 finishTest $ ExitFailure 2
4959 let overMax = currentBytesUsed gcStats > maxBytesAllowed
5060 underReset = currentBytesUsed gcStats < resetThreshold
51− when (overMax && failures > 4) $ do
61+ when (overMax && failures >= failureLimit) $ do
5262 putStrLn "FAILED: currentBytesUsed > maxBytesAllowed"
5363 finishTest $ ExitFailure 1
54− return $ Just (if overMax then succ failures else (if underReset then 0 else failures), succ n)
64+ return $ Just (
65+ if overMax
66+ then succ failures
67+ else (if underReset then 0 else failures), succ n)
5568 else do putStrLn "SUCCEEDED"
5669 finishTest ExitSuccess
5770 return Nothing