@@ -6,8 +6,6 @@ import Control.Monad
66import Control.Monad.IO.Class
77import Data.Int
88import GHC.Stats
9−import Language.Javascript.JSaddle.Types (liftJSM)
10−import Language.Javascript.JSaddle.Run
119import Language.Javascript.JSaddle.Warp
1210import Reflex.Dom.Core
1311import System.Exit
@@ -20,7 +18,7 @@ import System.Process
2018-- probably have a memory leak; going under the minimum doesn't indicate a
2119-- memory leak, but may mean the test needs to be updated.
2220minBytesAllowed, resetThreshold, maxBytesAllowed :: Int64
23−(minBytesAllowed, resetThreshold, maxBytesAllowed) = (200000, 400000, 440000)
21+(minBytesAllowed, resetThreshold, maxBytesAllowed) = (200000, 400000, 490000)
2422
2523main :: IO ()
2624main = do
@@ -40,13 +38,9 @@ main = do
4038 d <- holdDyn mempty $ mempty <$ domEvent Click e
4139 return ()
4240 postBuild <- getPostBuild
43− let f (!failures, !n) = if n < 3000
44− then do
45− liftIO $ performMajorGC
46− liftJSM $ do
47− _ <- waitForAnimationFrame
48− syncPoint
49− liftIO $ do
41+ let f (!failures, !n) = liftIO $ if n < 3000
42+ then do performMajorGC
43+ threadDelay 5000 -- Wait a bit to allow requestAnimationFrame to call its callback sometimes; this value was experimentally determined
5044 gcStats <- getGCStats
5145 print $ currentBytesUsed gcStats
5246 when (currentBytesUsed gcStats < minBytesAllowed) $ do
@@ -58,10 +52,9 @@ main = do
5852 putStrLn "FAILED: currentBytesUsed > maxBytesAllowed"
5953 finishTest $ ExitFailure 1
6054 return $ Just (if overMax then succ failures else (if underReset then 0 else failures), succ n)
61− else liftIO $ do
62− putStrLn "SUCCEEDED"
63− finishTest ExitSuccess
64− return Nothing
55+ else do putStrLn "SUCCEEDED"
56+ finishTest ExitSuccess
57+ return Nothing
6558 rec redraw <- performEvent <=< delay 0 $ f <$> leftmost
6659 [ ((0 :: Int), (0 :: Int)) <$ postBuild
6760 , fmapMaybe id redraw