thc:runtime
Copyright(C) 2026 Edward Kmett
LicenseUPL-1.0 AND BSD-3-Clause
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
PortabilityGHC FFI; THC runtime services or native fallback implementation
Safe HaskellTrustworthy
LanguageHaskell2010

THC.Memory

Description

Read-only memory accounting. A record contains independently sampled fields, not an atomic snapshot. All sizes are bytes.

Synopsis

Documentation

data Available a Source #

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

Instances details
Functor Available # 
Instance details

Defined in THC.Runtime.Types

Methods

fmap :: (a -> b) -> Available a -> Available b #

(<$) :: a -> Available b -> Available a #

Eq a => Eq (Available a) # 
Instance details

Defined in THC.Runtime.Types

Methods

(==) :: Available a -> Available a -> Bool #

(/=) :: Available a -> Available a -> Bool #

Ord a => Ord (Available a) # 
Instance details

Defined in THC.Runtime.Types

Show a => Show (Available a) # 
Instance details

Defined in THC.Runtime.Types

data MemoryUsage Source #

JVM-wide usage. Unknown maximum/initial sizes are Unavailable, not zero.

Instances

Instances details
Eq MemoryUsage # 
Instance details

Defined in THC.Memory

Show MemoryUsage # 
Instance details

Defined in THC.Memory

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.

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.