blob: 042ec6a0f72dcea5b060e0bf09f31f0f564b1853 [file] [log] [blame] [view]
Dianne Hackborn89bfe312011-07-26 21:55:07 -07001<!--
2 Copyright 2011 The Android Open Source Project
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15-->
16
17# Development Tips and Tricks #
18
19A collection of helpful tricks and available facilities for developing
20the platform code. This tips assume that you are working with an eng
21or userdebug build of the platform, not on a production device.
22
23## Debugging Native Memory Use ##
24
25Android's native memory allocator has some useful debugging features. You
26can turn on memory tracking with:
27
28 $ adb shell setprop libc.debug.malloc 1
29 $ adb shell stop
30 $ adb shell start
31
32You need to restart the runtime so that zygote and all processes launched from
33it are restarted with the property set. Now all Dalvik processes have memory
34tracking turned on. You can look at these with DDMS, but first you need to
35turn on its native memory UI:
36
37 - Open ~/.android/ddms.cfg
38 - Add a line "native=true"
39
40Upon relaunching DDMS and selecting a process, you can switch to the new
41native allocation tab and populate it with a list of allocations. This is
42especially useful for debugging memory leaks.