源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

61 行
2.0 KiB

  1. using System;
  2. using UnityEditor.MemoryProfiler;
  3. using UnityEngine;
  4. namespace MemoryProfilerWindow
  5. {
  6. //this is the highest level dataformat. it can be unpacked from the PackedCrawledMemorySnapshot, which contains all the interesting information we want. The Packed format
  7. //however is designed to be serializable and relatively storage compact. This dataformat is designed to give a nice c# api experience. so while the packed version uses typeIndex,
  8. //this version has TypeReferences, and also uses references to ThingInObject, instead of the more obscure object indexing pattern that the packed format uses.
  9. public class CrawledMemorySnapshot
  10. {
  11. public NativeUnityEngineObject[] nativeObjects;
  12. public GCHandle[] gcHandles;
  13. public ManagedObject[] managedObjects;
  14. public StaticFields[] staticFields;
  15. //contains concatenation of nativeObjects, gchandles, managedobjects and staticfields
  16. public ThingInMemory[] allObjects;
  17. public MemorySection[] managedHeap;
  18. public TypeDescription[] typeDescriptions;
  19. public PackedNativeType[] nativeTypes;
  20. public VirtualMachineInformation virtualMachineInformation;
  21. }
  22. public class ThingInMemory
  23. {
  24. public int size;
  25. public string caption;
  26. public ThingInMemory[] references;
  27. public ThingInMemory[] referencedBy;
  28. }
  29. public class ManagedObject : ThingInMemory
  30. {
  31. public UInt64 address;
  32. public TypeDescription typeDescription;
  33. }
  34. public class NativeUnityEngineObject : ThingInMemory
  35. {
  36. public int instanceID;
  37. public int classID;
  38. public string className;
  39. public string name;
  40. public bool isPersistent;
  41. public bool isDontDestroyOnLoad;
  42. public bool isManager;
  43. public HideFlags hideFlags;
  44. }
  45. public class GCHandle : ThingInMemory
  46. {
  47. }
  48. public class StaticFields : ThingInMemory
  49. {
  50. public TypeDescription typeDescription;
  51. public byte[] storage;
  52. }
  53. }