源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
672 B

  1. using System;
  2. using UnityEditor.MemoryProfiler;
  3. namespace MemoryProfilerWindow
  4. {
  5. static class ManagedHeapExtensions
  6. {
  7. public static BytesAndOffset Find(this MemorySection[] heap, UInt64 address, VirtualMachineInformation virtualMachineInformation)
  8. {
  9. foreach (var segment in heap)
  10. if (address >= segment.startAddress && address < (segment.startAddress + (ulong)segment.bytes.Length))
  11. return new BytesAndOffset() { bytes = segment.bytes, offset = (int)(address - segment.startAddress), pointerSize = virtualMachineInformation.pointerSize };
  12. return new BytesAndOffset();
  13. }
  14. }
  15. }