public static ulong FindOwner(ulong address, ClrDump clrDump, ClrType delegateType, ClrType arrayObjType, HashSet <ulong> visited) { if (visited.Contains(address)) { return(0); } var type = clrDump.GetObjectType(address); if (type == null) { return(0); } if (type != arrayObjType && (type.BaseType == null || type.BaseType != delegateType)) { return(address); } visited.Add(address); foreach (var newAddress in clrDump.GetReferers(address)) { var owner = FindOwner(newAddress, clrDump, delegateType, arrayObjType, visited); if (owner != 0) { return(owner); } } return(0); }
public static ulong FindOwner(ulong address, ClrDump clrDump, ClrType delegateType, ClrType arrayObjType, HashSet<ulong> visited) { if( visited.Contains(address)) { return 0; } var type = clrDump.GetObjectType(address); if (type == null) { return 0; } if( type != arrayObjType && (type.BaseType == null || type.BaseType != delegateType ) ) { return address; } visited.Add(address); var refs = clrDump.GetReferers(address); foreach(var newAddress in refs) { var owner = FindOwner(newAddress, clrDump, delegateType, arrayObjType, visited); if( owner != 0) { return owner; } } return 0; }