.. _stdlib_runtime_memory: ========================================= Context and idle-fork memory observations ========================================= .. das:module:: runtime_memory Context and retained idle-fork memory snapshots for runtime diagnostics. Sample on the owning context and publish value copies across threads. ++++++++++ Structures ++++++++++ .. _struct-runtime_memory-ContextMemory: .. das:attribute:: ContextMemory Memory sizes in bytes, sampled on the owning context. :Fields: * **heap_used** : uint64 - Live context heap bytes. * **heap_reserved** : uint64 - Reserved context heap bytes. * **strings_used** : uint64 - Live string heap bytes. * **strings_reserved** : uint64 - Reserved string heap bytes. * **stack** : uint64 - Context stack capacity. * **globals** : uint64 - Context global storage. * **native_stack** : uint64 - Current Emscripten thread stack capacity, zero elsewhere. .. _struct-runtime_memory-IdleForkMemory: .. das:attribute:: IdleForkMemory Memory retained by idle forks; active jobs are excluded. :Fields: * **count** : uint64 - Retained idle context count. * **memory** : :ref:`ContextMemory ` - Aggregate context sizes; native_stack is zero. +++++++++++++++++ Context snapshots +++++++++++++++++ * :ref:`context_idle_forks () : IdleForkMemory ` * :ref:`context_memory () : ContextMemory ` .. _function-runtime_memory_context_idle_forks: .. das:function:: context_idle_forks() : IdleForkMemory Idle job contexts retained by this owner. Join jobs before sampling to include the complete pool. Active forks are excluded rather than reading changing heaps. .. _function-runtime_memory_context_memory: .. das:function:: context_memory() : ContextMemory Samples the calling context. Publish the returned value copy across threads.