src/Microsoft.Diagnostics.Runtime/DacInterface/SOSDac13Old.cs [25:91]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private ref readonly ISOSDac13VTable VTable => ref Unsafe.AsRef(_vtable); public HResult TraverseLoaderHeap(ulong heap, LoaderHeapKind kind, LoaderHeapTraverse callback) { HResult hr = VTable.TraverseLoaderHeap(Self, heap, kind, Marshal.GetFunctionPointerForDelegate(callback)); GC.KeepAlive(callback); return hr; } public ClrDataAddress GetDomainLoaderAllocator(ClrDataAddress domainAddress) { if (domainAddress == 0) return 0; HResult hr = VTable.GetDomainLoaderAllocator(Self, domainAddress, out ClrDataAddress loaderAllocator); return hr ? loaderAllocator : 0; } public string[] GetLoaderAllocatorHeapNames() { HResult hr = VTable.GetLoaderAllocatorHeapNames(Self, 0, null, out int needed); if (hr && needed > 0) { nint[] pointers = new nint[needed]; fixed (nint* ptr = pointers) { if (hr = VTable.GetLoaderAllocatorHeapNames(Self, needed, ptr, out _)) { string[] result = new string[needed]; for (int i = 0; i < needed; i++) result[i] = Marshal.PtrToStringAnsi(pointers[i]) ?? ""; return result; } } } return Array.Empty(); } public (ClrDataAddress Address, LoaderHeapKind Kind)[] GetLoaderAllocatorHeaps(ClrDataAddress loaderAllocator) { if (loaderAllocator != 0) { HResult hr = VTable.GetLoaderAllocatorHeaps(Self, loaderAllocator, 0, null, null, out int needed); if (hr && needed > 0) { ClrDataAddress[] addresses = new ClrDataAddress[needed]; LoaderHeapKind[] kinds = new LoaderHeapKind[needed]; fixed (ClrDataAddress* ptrAddresses = addresses) fixed (LoaderHeapKind* ptrKinds = kinds) { if (hr = VTable.GetLoaderAllocatorHeaps(Self, loaderAllocator, addresses.Length, ptrAddresses, ptrKinds, out _)) { (ClrDataAddress, LoaderHeapKind)[] result = new (ClrDataAddress, LoaderHeapKind)[needed]; for (int i = 0; i < needed; i++) result[i] = (addresses[i], kinds[i]); return result; } } } } return Array.Empty<(ClrDataAddress, LoaderHeapKind)>(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - src/Microsoft.Diagnostics.Runtime/DacInterface/SosDac13.cs [28:94]: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - private ref readonly ISOSDac13VTable VTable => ref Unsafe.AsRef(_vtable); public HResult TraverseLoaderHeap(ulong heap, LoaderHeapKind kind, LoaderHeapTraverse callback) { HResult hr = VTable.TraverseLoaderHeap(Self, heap, kind, Marshal.GetFunctionPointerForDelegate(callback)); GC.KeepAlive(callback); return hr; } public ClrDataAddress GetDomainLoaderAllocator(ClrDataAddress domainAddress) { if (domainAddress == 0) return 0; HResult hr = VTable.GetDomainLoaderAllocator(Self, domainAddress, out ClrDataAddress loaderAllocator); return hr ? loaderAllocator : 0; } public string[] GetLoaderAllocatorHeapNames() { HResult hr = VTable.GetLoaderAllocatorHeapNames(Self, 0, null, out int needed); if (hr && needed > 0) { nint[] pointers = new nint[needed]; fixed (nint* ptr = pointers) { if (hr = VTable.GetLoaderAllocatorHeapNames(Self, needed, ptr, out _)) { string[] result = new string[needed]; for (int i = 0; i < needed; i++) result[i] = Marshal.PtrToStringAnsi(pointers[i]) ?? ""; return result; } } } return Array.Empty(); } public (ClrDataAddress Address, LoaderHeapKind Kind)[] GetLoaderAllocatorHeaps(ClrDataAddress loaderAllocator) { if (loaderAllocator != 0) { HResult hr = VTable.GetLoaderAllocatorHeaps(Self, loaderAllocator, 0, null, null, out int needed); if (hr && needed > 0) { ClrDataAddress[] addresses = new ClrDataAddress[needed]; LoaderHeapKind[] kinds = new LoaderHeapKind[needed]; fixed (ClrDataAddress* ptrAddresses = addresses) fixed (LoaderHeapKind* ptrKinds = kinds) { if (hr = VTable.GetLoaderAllocatorHeaps(Self, loaderAllocator, addresses.Length, ptrAddresses, ptrKinds, out _)) { (ClrDataAddress, LoaderHeapKind)[] result = new (ClrDataAddress, LoaderHeapKind)[needed]; for (int i = 0; i < needed; i++) result[i] = (addresses[i], kinds[i]); return result; } } } } return Array.Empty<(ClrDataAddress, LoaderHeapKind)>(); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -