Unity Heap Crawler
|
Tool for crawling mono heap and collecting memory usage. More...
Public Member Functions | |
HeapSnapshotCollector | AddRoot ([NotNull] object root, [NotNull] string name) |
HeapSnapshotCollector | AddRootTypes ([NotNull] params Type[] types) |
HeapSnapshotCollector | AddForbiddenTypes ([NotNull] params Type[] types) |
HeapSnapshotCollector | AddStaticTypes ([NotNull] params Type[] types) |
HeapSnapshotCollector | AddTrackedTypes ([NotNull] params Type[] types) |
CrawlSettings | AddRootsGroup ([NotNull] string filename, [NotNull] string caption, CrawlOrder order, params object[] roots) |
CrawlSettings | AddUnityRootsGroup< T > ([NotNull] string filename, [NotNull] string caption, CrawlOrder order) |
HeapSnapshotCollector | SetMinTypeSize (int size) |
HeapSnapshotCollector | SetSizeFormat (SizeFormat format) |
void | Start () |
Let The Crawling Begin! More... | |
Public Attributes | |
readonly CrawlSettings | UserRootsSettings |
CrawlSettings for user defined roots. More... | |
readonly CrawlSettings | StaticFieldsSettings |
CrawlSettings for static fields in all types. More... | |
readonly CrawlSettings | HierarchySettings |
CrawlSettings for GameObjects in scene hierarchy. More... | |
readonly CrawlSettings | ScriptableObjectsSettings |
CrawlSettings for all ScriptableObjects. More... | |
readonly CrawlSettings | PrefabsSettings |
CrawlSettings for all loaded Prefabs. More... | |
readonly CrawlSettings | UnityObjectsSettings |
CrawlSettings for all other Unity objects (Texture, Material, etc). More... | |
bool | DifferentialMode = true |
Only show new objects (compared to previous snapshot) in all reports More... | |
Tool for crawling mono heap and collecting memory usage.
HeapSnapshotCollector UnityHeapCrawler.HeapSnapshotCollector.AddForbiddenTypes | ( | [NotNull] params Type [] | types | ) |
Forbid some types to be crawled. Crawler will not follow links to instances of those types or count them to total size.
Useful when you need to collect only a local snapshot from custom definded roots without triggering whole heap to be crawled. Also can be useful to reduce memory consumption by crawling only a part of the heap.
types | Forbidden types |
HeapSnapshotCollector UnityHeapCrawler.HeapSnapshotCollector.AddRoot | ( | [NotNull] object | root, |
[NotNull] string | name | ||
) |
Add custom root. It will be crawled before any other objects.
It should be useful to add your big singletons as custom roots.
root | Root to crawl (C# object instance) |
name | Root name in report |
CrawlSettings UnityHeapCrawler.HeapSnapshotCollector.AddRootsGroup | ( | [NotNull] string | filename, |
[NotNull] string | caption, | ||
CrawlOrder | order, | ||
params object [] | roots | ||
) |
Add custom roots crawling group. Results will be wrtitten to a seperate file.
Explicit objects version.
filename | Filename for group output |
caption | Group caption |
order | Crawling priority |
roots | Root objects |
HeapSnapshotCollector UnityHeapCrawler.HeapSnapshotCollector.AddRootTypes | ( | [NotNull] params Type [] | types | ) |
Add root types.
Objects of these types will be treated as roots and will not be included into crawl trees they were found in.
types | Root types |
HeapSnapshotCollector UnityHeapCrawler.HeapSnapshotCollector.AddStaticTypes | ( | [NotNull] params Type [] | types | ) |
Add additional types to check for static fields and add them as roots.
This is a workaround for an unsupported case. Consider following class:
class GenericClass<T> { public static List<T> StaticList; }
Static fields GenericClass<A>.StaticList
and GenericClass<B>.StaticList
would be different lists that should both be counted as roots. Crawler cannot find those roots automatically due to C# Reflection limitations.
types | Forbidden types |
HeapSnapshotCollector UnityHeapCrawler.HeapSnapshotCollector.AddTrackedTypes | ( | [NotNull] params Type [] | types | ) |
Enable root paths tracking for specific types.
Can affect memory consumption - for each instance of specified types all root paths to it will be logged. Useful when you already know exact type is leaked and need to find what is holding it.
types | Types to track |
CrawlSettings UnityHeapCrawler.HeapSnapshotCollector.AddUnityRootsGroup< T > | ( | [NotNull] string | filename, |
[NotNull] string | caption, | ||
CrawlOrder | order | ||
) |
Add custom roots crawling group. Results will be wrtitten to a seperate file.
All Unity objects of specified type are included in the group.
filename | Filename for group output |
caption | Group caption |
order | Crawling priority |
HeapSnapshotCollector UnityHeapCrawler.HeapSnapshotCollector.SetMinTypeSize | ( | int | size | ) |
Set minimum size for type to be included in types report.
All instances of the type should be at least this size total for type to be included in type report.
size | Minimum size type |
HeapSnapshotCollector UnityHeapCrawler.HeapSnapshotCollector.SetSizeFormat | ( | SizeFormat | format | ) |
Set sizes format in output.
Short
54.8 MB
Precise
54829125
Combined
54.8 MB (54829125)
format |
void UnityHeapCrawler.HeapSnapshotCollector.Start | ( | ) |
Let The Crawling Begin!
bool UnityHeapCrawler.HeapSnapshotCollector.DifferentialMode = true |
Only show new objects (compared to previous snapshot) in all reports
Useful to find memory leaks
readonly CrawlSettings UnityHeapCrawler.HeapSnapshotCollector.HierarchySettings |
CrawlSettings for GameObjects in scene hierarchy.
Modify them after construction to change output format or disable crawling. Be careful when reducing filtering - large crawl trees will affect memory consumption.
readonly CrawlSettings UnityHeapCrawler.HeapSnapshotCollector.PrefabsSettings |
CrawlSettings for all loaded Prefabs.
Modify them after construction to change output format or disable crawling. Be careful when reducing filtering - large crawl trees will affect memory consumption.
readonly CrawlSettings UnityHeapCrawler.HeapSnapshotCollector.ScriptableObjectsSettings |
CrawlSettings for all ScriptableObjects.
Modify them after construction to change output format or disable crawling. Be careful when reducing filtering - large crawl trees will affect memory consumption.
readonly CrawlSettings UnityHeapCrawler.HeapSnapshotCollector.StaticFieldsSettings |
CrawlSettings for static fields in all types.
Modify them after construction to change output format or disable crawling. Be careful when reducing filtering - large crawl trees will affect memory consumption.
readonly CrawlSettings UnityHeapCrawler.HeapSnapshotCollector.UnityObjectsSettings |
CrawlSettings for all other Unity objects (Texture, Material, etc).
Modify them after construction to change output format or disable crawling. Be careful when reducing filtering - large crawl trees will affect memory consumption.
readonly CrawlSettings UnityHeapCrawler.HeapSnapshotCollector.UserRootsSettings |
CrawlSettings for user defined roots.
Modify them after construction to change output format or disable crawling. Be careful when reducing filtering - large crawl trees will affect memory consumption.