Skip to content
Snippets Groups Projects
Commit ae785972 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1998-08-04 15:21:15 by simonm]

add a quick stable ptr stress test.
parent 65b3f09c
No related merge requests found
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.2 1998/07/08 10:36:54 simonm Exp $
# $Id: Makefile,v 1.3 1998/08/04 15:21:15 simonm Exp $
TOP = ../..
include $(TOP)/mk/boilerplate.mk
......@@ -8,6 +8,7 @@ include $(TOP)/mk/should_run.mk
SRC_HC_OPTS += -dcore-lint
packedstring001_HC_OPTS = -syslib misc
stableptr001_RUNTEST_OPTS = +RTS -K4m
SRC_MKDEPENDHS_OPTS += -syslib misc
......
{-# OPTIONS -fglasgow-exts #-}
module Main where
import Foreign
-- simple test for building/dereferencing stable ptrs
main
= do l <- mapM makeStablePtr [1..100000]
sum <- stable_sum l
print sum
stable_sum :: [StablePtr Integer] -> IO Integer
stable_sum [] = return 0
stable_sum (x:xs)
= do x' <- deRefStablePtr x
freeStablePtr x
xs' <- stable_sum xs
return (x' + xs')
5000050000
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment