text
stringlengths
1
372
the VM has limited space where it can store CPU sample information.
at a higher sampling rate, the space fills up and begins
to overflow sooner than it would have if a lower sampling
rate was used.
this means that you might not have access to CPU samples
from the beginning of the recorded profile, depending
on whether the buffer overflows during the time of recording.
a profile that was recorded with a lower sampling rate
yields a more coarse-grained CPU profile with fewer samples.
this affects your app’s performance less,
but you might have access to less information about what
the CPU was doing during the time of the profile.
the VM’s sample buffer also fills more slowly, so you can see
CPU samples for a longer period of app run time.
this means that you have a better chance of viewing CPU
samples from the beginning of the recorded profile.
<topic_end>
<topic_start>
filtering
when viewing a CPU profile, you can filter the data by
library, method name, or UserTag.
<topic_end>
<topic_start>
guidelines
when looking at a call tree or bottom up view,
sometimes the trees can be very deep.
to help with viewing parent-child relationships in a deep tree,
enable the display guidelines option.
this adds vertical guidelines between parent and child in the tree.
<topic_end>
<topic_start>
other resources
to learn how to use DevTools to analyze
the CPU usage of a compute-intensive mandelbrot app,
check out a guided CPU profiler view tutorial.
also, learn how to analyze CPU usage when the app
uses isolates for parallel computing.
<topic_end>
<topic_start>
using the memory view
the memory view provides insights into details
of the application’s memory allocation and
tools to detect and debug specific issues.
info note
this page is up to date for DevTools 2.23.0.
for information on how to locate DevTools screens in different IDEs,
check out the DevTools overview.
to better understand the insights found on this page,
the first section explains how dart manages memory.
if you already understand dart’s memory management,
you can skip to the memory view guide.
<topic_end>
<topic_start>
reasons to use the memory view
use the memory view for preemptive memory optimization or when
your application experiences one of the following conditions:
<topic_end>
<topic_start>
basic memory concepts
dart objects created using a class constructor
(for example, by using MyClass()) live in a
portion of memory called the heap. the memory
in the heap is managed by the dart VM (virtual machine).
the dart VM allocates memory for the object at the moment of the object creation,
and releases (or deallocates) the memory when the object
is no longer used (see dart garbage collection).
<topic_end>
<topic_start>
object types
<topic_end>
<topic_start>
disposable object
a disposable object is any dart object that defines a dispose() method.
to avoid memory leaks, invoke dispose when the object isn’t needed anymore.
<topic_end>
<topic_start>
memory-risky object
a memory-risky object is an object that might cause a memory leak,
if it is not disposed properly or disposed but not GCed.
<topic_end>
<topic_start>
root object, retaining path, and reachability
<topic_end>
<topic_start>
root object
every dart application creates a root object that references,
directly or indirectly, all other objects the application allocates.
<topic_end>
<topic_start>
reachability
if, at some moment of the application run,
the root object stops referencing an allocated object,
the object becomes unreachable,
which is a signal for the garbage collector (gc)
to deallocate the object’s memory.
<topic_end>
<topic_start>
retaining path
the sequence of references from root to an object
is called the object’s retaining path,