1 page.title=Debugging Native Memory Use 2 @jd:body 3 4 <!-- 5 Copyright 2013 The Android Open Source Project 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 --> 19 <h2 id="malloc_debug">Malloc debug</h2> 20 21 <p>See <a 22 href="https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README.md">Malloc 23 Debug</a> and <a 24 href="https://android.googlesource.com/platform/bionic/+/master/libc/malloc_debug/README_api.md">Native 25 Memory Tracking using libc Callbacks</a> for a thorough description of the 26 debugging options available for native memory issues.</p> 27 28 <h2 id="ddms">Dalvik Debug Monitor Server</h2> 29 30 <p>You can also use the <a 31 href="https://developer.android.com/studio/profile/ddms.html">Dalvik Debug 32 Monitor Server</a> (DDMS) to obtain a graphical view of Malloc Debug 33 output.</p> 34 35 <p>To use DDMS, first turn on its native memory UI:</p> 36 <ol> 37 <li>Open <code>~/.android/ddms.cfg</code></li> 38 <li>Add the line: <code>native=true</code></li> 39 </ol> 40 41 <p>Upon relaunching DDMS and selecting a process, you can switch to the new 42 native allocation tab and populate it with a list of allocations. This is 43 especially useful for debugging memory leaks.</p> 44