| Copyright | (C) 2026 Edward Kmett |
|---|---|
| License | UPL-1.0 AND BSD-3-Clause |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | GHC FFI; THC runtime services or native fallback implementation |
| Safe Haskell | Trustworthy |
| Language | Haskell2010 |
THC.Memory
Description
Read-only memory accounting. A record contains independently sampled fields, not an atomic snapshot. All sizes are bytes.
Synopsis
- data Available a
- = Available a
- | Unsupported
- | Disabled
- | Denied
- | Unavailable
- data MemoryUsage = MemoryUsage {}
- data NativeAllocationUsage = NativeAllocationUsage {}
- heapUsage :: IO MemoryUsage
- nonHeapUsage :: IO MemoryUsage
- nativeAllocationUsage :: IO NativeAllocationUsage
Documentation
An absent metric is not zero. Queries never enable JVM-wide monitoring.
fmap transforms a genuine value and preserves every non-value status:
>>>fmap (+ 1) (Available (41 :: Int))Available 42>>>fmap (+ 1) (Disabled :: Available Int)Disabled>>>map (fmap (+ 1)) [Unsupported, Disabled, Denied, Unavailable :: Available Int][Unsupported,Disabled,Denied,Unavailable]
Constructors
| Available a | A genuine value; its scope is specified by the query. |
| Unsupported | The runtime or provider does not implement this service. |
| Disabled | Supported, but its instrumentation or sink is switched off. |
| Denied | The current context or host security policy forbids access. |
| Unavailable | Normally supported, but no value is currently available. |
Instances
| Functor Available # | |
| Eq a => Eq (Available a) # | |
| Ord a => Ord (Available a) # | |
Defined in THC.Runtime.Types | |
| Show a => Show (Available a) # | |
data MemoryUsage Source #
JVM-wide usage. Unknown maximum/initial sizes are Unavailable, not zero.
Constructors
| MemoryUsage | |
Fields | |
Instances
| Eq MemoryUsage # | |
Defined in THC.Memory | |
| Show MemoryUsage # | |
Defined in THC.Memory Methods showsPrec :: Int -> MemoryUsage -> ShowS # show :: MemoryUsage -> String # showList :: [MemoryUsage] -> ShowS # | |
data NativeAllocationUsage Source #
Only live allocations owned by the current THC context's libc allocator. Counts requested bytes; excludes other SulongnativeJVM/pinned allocations and allocator overhead. Includes allocations awaiting outstanding borrowers before release. This is not process RSS or total native memory.
Constructors
| NativeAllocationUsage | |
Instances
| Eq NativeAllocationUsage # | |
Defined in THC.Memory Methods (==) :: NativeAllocationUsage -> NativeAllocationUsage -> Bool # (/=) :: NativeAllocationUsage -> NativeAllocationUsage -> Bool # | |
| Show NativeAllocationUsage # | |
Defined in THC.Memory Methods showsPrec :: Int -> NativeAllocationUsage -> ShowS # show :: NativeAllocationUsage -> String # showList :: [NativeAllocationUsage] -> ShowS # | |
heapUsage :: IO MemoryUsage Source #
Sample JVM heap usage. Unsupported or unknown quantities keep their status rather than becoming zero; this does not trigger garbage collection.
nonHeapUsage :: IO MemoryUsage Source #
Sample JVM non-heap usage, with the same per-field status contract as
heapUsage. This is not the context's native-allocation accounting.
nativeAllocationUsage :: IO NativeAllocationUsage Source #
Sample live requested bytes and allocation count for the current context's
libc allocator. See NativeAllocationUsage for the accounting exclusions.