Nebula
Loading...
Searching...
No Matches
Scripting::MemoryProfile Class Reference

#include <memoryprofile.h>

Detailed Description

The managed runtime's memory state, as this side can read it.

The runtime keeps the numbers and this only asks for them, so nothing here is remembered between frames.

The field order is the layout both sides write and read. The eight byte fields before the four byte ones are what make the sample 192 bytes on both sides without padding, the same reason TimeManager's snapshot is laid out that way. The managed side mirrors it in NebulaEngine/engine/MemoryProfile.cs, and the size is checked in nsharp/memoryprofile.cc.

The generations are the ones the runtime reports. The last two are the large object heap and the pinned object heap, which are collected with gen2 rather than on a count of their own, so the sizes go to five while the counts a panel would read stop at three.

See also
Scripting::ScriptFeatureUnit
Scripting::MemoryProfilerPanel
Nebula.Game.MemoryProfile

Classes

struct  Sample
 one read of the managed heap. The values are the runtime's own, not this side's More...

Static Public Member Functions

static void Register (Scripting::NSharpServer *server, Scripting::AssemblyId assemblyId)
 resolve the managed entry points. Called by the feature unit at activation
static void Clear ()
 drop the resolved entry points. The server closes, and the pointers go stale with it
static bool IsRegistered ()
 true when the runtime is loaded and the entry point was found
static bool Read (Sample &out)
 read the runtime's memory state. Returns false when there is nothing to read
static void Collect ()
 run a full collection on the managed heap

Static Public Attributes

static const IndexT NumGenerations = 5
 the generations the runtime reports. The last two are the large and the pinned object heaps

Static Private Attributes

static void * readSample = nullptr
static void * collect = nullptr

Member Function Documentation

◆ Clear()

void Scripting::MemoryProfile::Clear ( )
static

drop the resolved entry points. The server closes, and the pointers go stale with it

The server closes and the pointers it answered with go stale with it, so this is what the feature unit calls when it deactivates.

A reload registers again.

◆ Collect()

void Scripting::MemoryProfile::Collect ( )
static

run a full collection on the managed heap

◆ IsRegistered()

bool Scripting::MemoryProfile::IsRegistered ( )
static

true when the runtime is loaded and the entry point was found

◆ Read()

bool Scripting::MemoryProfile::Read ( Sample & out)
static

read the runtime's memory state. Returns false when there is nothing to read

The buffer is this side's, so the managed side only writes into it.

A read that fails leaves the sample zeroed, which is what keeps the panel from drawing numbers that were never read.

◆ Register()

void Scripting::MemoryProfile::Register ( Scripting::NSharpServer * server,
Scripting::AssemblyId assemblyId )
static

resolve the managed entry points. Called by the feature unit at activation

The feature unit resolves the entry points here, which is the same point at which it resolves the ones the frame flush runs through.

A run with no plugin leaves them null, and the panel then has nothing to read.

Member Data Documentation

◆ collect

void * Scripting::MemoryProfile::collect = nullptr
staticprivate

◆ NumGenerations

const IndexT Scripting::MemoryProfile::NumGenerations = 5
static

the generations the runtime reports. The last two are the large and the pinned object heaps

◆ readSample

void * Scripting::MemoryProfile::readSample = nullptr
staticprivate

The documentation for this class was generated from the following files: