Skip to content

Commit 449c646

Browse files
committed
Fix space leak in System.Metric.Label.set
1 parent 40ced1b commit 449c646

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

System/Metrics/Label.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module System.Metrics.Label
1212
, modify
1313
) where
1414

15-
import Data.IORef (IORef, atomicModifyIORef, newIORef, readIORef)
15+
import Data.IORef (IORef, atomicModifyIORef, atomicWriteIORef, newIORef, readIORef)
1616
import qualified Data.Text as T
1717
import Prelude hiding (read)
1818

@@ -29,7 +29,7 @@ read = readIORef . unC
2929

3030
-- | Set the label to the given value.
3131
set :: Label -> T.Text -> IO ()
32-
set (C ref) !i = atomicModifyIORef ref $ \ _ -> (i, ())
32+
set (C ref) !i = atomicWriteIORef ref i
3333

3434
-- | Set the label to the result of applying the given function to the
3535
-- value.

0 commit comments

Comments
 (0)