getGCStats was broken in 8.2
The getGCStats
function from GHC.Stats
defined here expects the numGCs
field to be an Int64
, but in the new RTSStats
API, it's a Word32
, so the function inside is no longer correct:
getGCStats = do
...
allocaBytes ((232)) $ \p -> do
{-# LINE 284 "GHC/Stats.hsc" #-}
getRTSStats_ p
bytesAllocated <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) p
{-# LINE 286 "GHC/Stats.hsc" #-}
numGcs <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) p
{-# LINE 287 "GHC/Stats.hsc" #-}
numByteUsageSamples <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) p
The numGcs
line peeks off 8 bytes instead of 4, and so it leads to packages like my weigh
package claiming that you've done "4,294,967,299" garbage collections. I've updated weigh
to use the new API with some CPP #if
's.
Given that the new API changes pretty much everything, both names and types (it took a couple hours to make weigh support the old and the new one), and that the old "compatibility" API is returning bad results, honestly I wouldn't have minded if the old API was just removed in 8.2.
Leaving it up to you whether this should be fixed in an 8.2.3 bugfix release or just leave it to be removed in 8.4.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |