summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/alloccounter1.hs
blob: 9fe682aca4e8d2f0b3b584140ff386f046db183f (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 (sort)
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