Skip to content

Commit a9b3c73

Browse files
committed
Add ignoreForgottenRefs
1 parent 02e3bf6 commit a9b3c73

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src-control/Control/RefCount.hs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ module Control.RefCount (
2929

3030
-- * Test API
3131
, checkForgottenRefs
32+
, ignoreForgottenRefs
3233
) where
3334

3435
import Control.DeepSeq
3536
import Control.Exception (assert)
36-
import Control.Monad (when)
37+
import Control.Monad (void, when)
3738
import Control.Monad.Class.MonadThrow
3839
import Control.Monad.Primitive
3940
import Data.Primitive.PrimVar
@@ -546,6 +547,10 @@ checkForgottenRefs = do
546547
where
547548
#endif
548549

550+
-- | Run 'checkForgottenRefs', but ignore the resulting exception, if any.
551+
ignoreForgottenRefs :: IO ()
552+
ignoreForgottenRefs = void $ try @_ @SomeException $ checkForgottenRefs
553+
549554
#ifdef NO_IGNORE_ASSERTS
550555
performMajorGCWithBlockingIfAvailable :: IO ()
551556
performMajorGCWithBlockingIfAvailable = do

0 commit comments

Comments
 (0)