[commit: ghc] master: rts: remove stable-names from hashtable upon free (b75d126)

git at git.haskell.org git at git.haskell.org
Mon May 19 05:10:34 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/b75d126e779e8690c675be84e8972dc023e04b9b/ghc

>---------------------------------------------------------------

commit b75d126e779e8690c675be84e8972dc023e04b9b
Author: Edward Z. Yang <ezyang at cs.stanford.edu>
Date:   Sun May 18 21:32:10 2014 -0500

    rts: remove stable-names from hashtable upon free
    
    This fixes #9078.
    
    Signed-off-by: Austin Seipp <austin at well-typed.com>


>---------------------------------------------------------------

b75d126e779e8690c675be84e8972dc023e04b9b
 rts/Stable.c                     |  1 +
 testsuite/tests/rts/T9078.hs     | 10 ++++++++++
 testsuite/tests/rts/T9078.stderr |  2 ++
 testsuite/tests/rts/all.T        |  3 +++
 4 files changed, 16 insertions(+)

diff --git a/rts/Stable.c b/rts/Stable.c
index ec74b0d..431b7c6 100644
--- a/rts/Stable.c
+++ b/rts/Stable.c
@@ -246,6 +246,7 @@ STATIC_INLINE void
 freeSnEntry(snEntry *sn)
 {
   ASSERT(sn->sn_obj == NULL);
+  removeHashTable(addrToStableHash, (W_)sn->old, NULL);
   sn->addr = (P_)stable_name_free;
   stable_name_free = sn;
 }
diff --git a/testsuite/tests/rts/T9078.hs b/testsuite/tests/rts/T9078.hs
new file mode 100644
index 0000000..d0389f1
--- /dev/null
+++ b/testsuite/tests/rts/T9078.hs
@@ -0,0 +1,10 @@
+module Main where
+
+import Control.Monad
+import System.Mem.StableName
+
+main :: IO ()
+main = replicateM_ 500000 (makeStableName foo)
+
+foo :: Int
+foo = 1
diff --git a/testsuite/tests/rts/T9078.stderr b/testsuite/tests/rts/T9078.stderr
new file mode 100644
index 0000000..901a1ca
--- /dev/null
+++ b/testsuite/tests/rts/T9078.stderr
@@ -0,0 +1,2 @@
+cap 0: initialised
+cap 0: shutting down
diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T
index f5a72f8..a56a3f3 100644
--- a/testsuite/tests/rts/all.T
+++ b/testsuite/tests/rts/all.T
@@ -227,3 +227,6 @@ test('T8124', [ only_ways(threaded_ways), omit_ways(['ghci']),
 # The ghci way gets confused by the RTS options
 test('T9045', [ omit_ways(['ghci']), extra_run_opts('10000 +RTS -A8k -RTS') ], compile_and_run, [''])
 
+# I couldn't reproduce 9078 with the -threaded runtime, but could easily
+# with the non-threaded one.
+test('T9078', [ omit_ways(threaded_ways) ], compile_and_run, ['-with-rtsopts="-DS" -debug'])



More information about the ghc-commits mailing list