blob: 2d6f567cae2d1e81f864e83e95a777bd68780d0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
import Foreign.StablePtr
-- compile without optimisation.
-- run with +RTS -D256 to see the stable pointer being garbage collected.
main = do
let xs = [ 1 .. 50000 ]
let ys = [ 1 .. 60000 ]
s1 <- newStablePtr xs
print (sum xs)
freeStablePtr s1
print (sum ys)
|