Table of Contents

Class VhMemory

Namespace
VpnHood.Net.Toolkit.Memory
Assembly
VpnHood.Net.Toolkit.dll

Ambient context for reading memory figures (see VhMemoryInfo) — including the process footprint an OS memory limit is enforced against (e.g. iOS jetsam's phys_footprint). .NET has no single cross-platform API for these, so each host installs a platform implementation once at init by assigning Instance (mirrors how VhLogger.Instance is set). Whatever a platform can't measure it returns as null. Consumers read via VhMemory.Instance without any dependency on a specific host; this type lives in Toolkit because every assembly already references it.

Instance defaults to a null-object that reports nothing, so callers never need a null check.

public abstract class VhMemory
Inheritance
VhMemory
Derived
Inherited Members

Properties

Instance

The active implementation. Defaults to a no-op that reports all-null; a host replaces it at init (e.g. the iOS device/service installs its native reader). Set once during startup.

public static VhMemory Instance { get; set; }

Property Value

VhMemory

Methods

GetInfo()

Returns the current memory snapshot. Implementations must not throw (report unavailable figures as null instead), because consumers read this on hot paths. Read a specific figure via the returned struct, e.g. VhMemory.Instance.GetInfo().ProcessFootprintMb.

public abstract VhMemoryInfo GetInfo()

Returns

VhMemoryInfo

The snapshot, with null for each figure the platform cannot report.