Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1614f115 authored by Rich Slogar's avatar Rich Slogar Committed by Android Git Automerger
Browse files

am 8f0d5451: am e5fe2468: docs: studio 1.3 allocation tracker

* commit '8f0d5451':
  docs: studio 1.3 allocation tracker
parents 605c890b 8f0d5451
Loading
Loading
Loading
Loading
+545 B
Loading image diff...
+237 KiB
Loading image diff...
+28 −2
Original line number Diff line number Diff line
@@ -300,7 +300,33 @@ allocations that need to be done for that behavior, what thread they are on, and
from. This is extremely valuable for tightening up these paths to reduce the work they need and
improve the overall smoothness of the UI.</p>

<p>To use Allocation Tracker:</p>
<p>To use the Allocation Tracker, open the Memory Monitor in Android Studio and click the 
<a href="{@docRoot}tools/studio/index.html#alloc-tracker" style="vertical-align:bottom;margin:0;height:21px">
Allocation Tracker</a> icon. You can also track allocations in the Android Device Monitor:</p>


<h3>Android Studio </h3>
<p>To use the <a href="{@docRoot}tools/studio/index.html#alloc-tracker">Allocation Tracker</a> in
Android Studio: </p>

<ol>
  <li>Start your app on a connected device or emulator</li>
  <li>Open the Android run-tme window, and view the free and allocated memory in the Memory
    Monitor. </li>
  <li>Click the Allocation Tracker icon
    (<img src="{@docRoot}images/tools/studio-allocation-tracker-icon.png" style="vertical-align:bottom;margin:0;height:21px"/>) in the Memory Monitor tool bar to start and stop memory
    allocations. 
    <p>Android Studio creates the allocation file with the filename
    <code>Allocations-yyyy.mm.dd-hh.mm.ss.alloc</code> in the <em>Captures</em> tab. </p> 
     </li>
  <li>Double-click the allocation file to open the Allocation viewer.  </li>
  <li>Identify which actions in your app are likely causing too much allocation and determine where
   in your app you should try to reduce allocations and release resources.
</ol>



<h3>Device Monitor</h3>
<ol>
<li>Open the Device Monitor.
<p>From your <code>&lt;sdk>/tools/</code> directory, launch the <code>monitor</code> tool.</p>
@@ -641,7 +667,7 @@ hprof-conv heap-original.hprof heap-converted.hprof
</pre>

<p class="note"><strong>Note:</strong> If you're using the version of DDMS that's integrated into
Eclipse, you do not need to perform the HPROF conversion—DDMS performs the conversion by
Eclipse, you do not need to perform the HPROF conversation—it performs the conversion by
default.</p>

<p>You can now load the converted file in MAT or another heap analysis tool that understands
+10 −5
Original line number Diff line number Diff line
@@ -90,19 +90,24 @@ page.article=true
         alt=""
         width="400px" />
      <p class="img-caption">
        <strong>Figure 1. </strong>Steps for starting Allocation Tracker.
        <strong>Figure 1. </strong>Steps for starting Allocation Tracker in Android DDMS.
      </p>
    </div>

    <li>Connect your mobile device to your computer.</li>

    <li>Open your application in Android Studio, build the source, and run it on your device.</li>
    <li>Open your application in Android Studio, build the source, and run it on your device or
      emulator.</li>

    <li>Click the <b>Android</b> button at the bottom of your Android Studio window.</li>

    <li>Click the RECORD button
    <li>If you are using the Android Device Monitor, click the RECORD button
        <img src="{@docRoot}images/tools/performance/allocation-tracker/gettingstarted_image02.png">
        (Start Allocation Tracking tooltip).</li>
        (Start Allocation Tracking tooltip) in the Android DDMS tool bar. If you are using Android
        Studio, click the
        <img src="{@docRoot}images/tools/performance/allocation-tracker/gettingstarted_image02.png">
        icon in the <a href="{@docRoot}tools/studio/index.html#mem-cpu">Memory Monitor</a> tool
        bar. </li>

    <li>Interact with your application.</li>

@@ -119,7 +124,7 @@ page.article=true
         alt=""
         width="440px" />
      <p class="img-caption">
        <strong>Figure 2. </strong>Example of Allocation Tracker output.
        <strong>Figure 2. </strong>Example of Allocation Tracker output in Android DDMS.
      </p>
    </div>

+1 −1
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ page.article=true
    <h2 id="AllocationTracker">Allocation Tracker</h2>

  <div class="figure" style="">
    <img src="{@docRoot}images/tools/performance/compare_AllocationTracker.png"
    <img src="{@docRoot}images/tools/studio-allocation-tracker.png"
         alt=""ge
         height="" />
    <p class="img-caption">
Loading