Skip to content

JSRuntimeContext.GCHandleCount property

Gets the count of GC handles allocated in the current runtime context. Useful for detecting memory leaks related to .NET + JS interop.

C#
public long GCHandleCount { get; }

Remarks

JS objects use GC handles to hold onto .NET objects. When a JS object is garbage- collected, the GC handle it holds (if any) is freed, and then the .NET object becomes available for .NET garbage-collection (assuming there are no other GC handles or .NET references to the same object).

See Also

Released under the MIT license