From 93ef21b00b635a3db076ff07a3ffa9ac73ba1eaa Mon Sep 17 00:00:00 2001 From: Jens Johansen Date: Mon, 5 Dec 2022 15:02:27 +0000 Subject: [PATCH] [vm] Add examples to heapsnapshot tool Change-Id: I2b3735341146e532a747e302050e3983ee8f7e1c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273240 Reviewed-by: Martin Kustermann Commit-Queue: Jens Johansen --- runtime/tools/heapsnapshot/README | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 runtime/tools/heapsnapshot/README diff --git a/runtime/tools/heapsnapshot/README b/runtime/tools/heapsnapshot/README new file mode 100644 index 00000000000..626c8e4030b --- /dev/null +++ b/runtime/tools/heapsnapshot/README @@ -0,0 +1,67 @@ +Examples: + +# Load +load + +# Show named sets / known variables +info + +# Find live objects +closure roots + +# or give a name +all = closure roots + +# Look into the object +stats all + +# Filter lists from "all" into "lists" +lists = filter all _List + +# Find empty lists into "empty-lists" +empty-lists = dfilter lists ==0 + +# Who's using the empty lists? +users empty-lists + +# print that info (from $0 in this case as we didn't give it a name but it was +# the first one we didn't give a name) +stat $0 + +# Filter more +empty-growable-lists = filter (users empty-lists) _GrowableList + +# Print +stats empty-growable-lists + +# Who's using them? +retainers empty-growable-lists + +# Look into strings next +strings = filter all String + +# What's inside the strings +dstats strings + +# Who's pointing to the big strings? +retainers (dfilter strings >=1024) + +# Small strings +small-strings = dfilter strings <100 + +# See them +dstats small-strings + +# Who's retaining the string "foo" +f = dfilter small-strings foo +retainters f + +# Find stuff with specific field +hasField = filter all :specificField +stats closure hasField :specificField +foo = follow hasField :specificField +stats closure foo + +# Stop the closure search if going into specific files +stats closure foo ^file1.dart ^file2.dart ^file3.dart +