blob: 60dc9c4a120838c5b1b3a048d11cdda191c52833 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
import Foreign
import System.Mem.Weak
kill:: Ptr a -> IO ()
kill a = do
w <- mkWeakPtr a Nothing
addFinalizer a $
deRefWeak w >> return ()
main:: IO ()
main = sequence_ . take 10000 . repeat $
mallocBytes 100 >>= kill >> return ()
|