summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GHC/GC_Hook.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/GHC/GC_Hook.hs b/src/GHC/GC_Hook.hs
index 44826c9..35fbbc5 100644
--- a/src/GHC/GC_Hook.hs
+++ b/src/GHC/GC_Hook.hs
@@ -1,4 +1,5 @@
{-# LANGUAGE ForeignFunctionInterface #-}
+{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TypeApplications #-}
module GHC.GC_Hook (
setGCHook,
@@ -97,6 +98,12 @@ setGCHook = do
-- will never get the same structure twice.
getGCLog :: IO [Details]
getGCLog =
+ getLogBatch >>= \case
+ [] -> return []
+ batch -> (batch ++) <$> getGCLog
+
+getLogBatch :: IO [Details]
+getLogBatch =
let bufferCapacity = 2048
in allocaBytes bufferCapacity $ \pbuffer ->
alloca $ \punitsize ->