summaryrefslogtreecommitdiff
path: root/testsuite/tests/lib/should_run/stableptr004.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/lib/should_run/stableptr004.hs')
-rw-r--r--testsuite/tests/lib/should_run/stableptr004.hs12
1 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/lib/should_run/stableptr004.hs b/testsuite/tests/lib/should_run/stableptr004.hs
new file mode 100644
index 0000000000..2d6f567cae
--- /dev/null
+++ b/testsuite/tests/lib/should_run/stableptr004.hs
@@ -0,0 +1,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)