summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/alloccounter1.hs
blob: 4b81896d2ca5e2b869fe7151826ef5d09662fcdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module Main where

import Control.Exception
import Control.Monad
import Data.List
import System.Mem

main = do
  let
    testAlloc n = do
      let start = 999999
      setAllocationCounter start
      evaluate (last [1..n])
      c <- getAllocationCounter
      -- print (start - c)
      return (start - c)
  results <- forM [1..1000] testAlloc
  print (sort results == results)
    -- results better be in ascending order