Thursday, January 19, 2012

Quick Memory Footprint Savings

Following the TI link I mentioned in a previous post, my first pass at cutting out the "fat" for a Headless Android build resulted in a savings of 151 MB of resident memory. My process list went from (bolded processes removed):

system    2222  1     816    272   80343750 6fd0b6fc S /system/bin/servicemanager
root      2223  1     3872   588   ffffffff 6fd0bdac S /system/bin/vold
root      2224  1     3872   576   ffffffff 6fd0bdac S /system/bin/netd
root      2225  1     820    320   800e9ea4 6fd0b844 S /system/bin/dispd
root      2226  1     676    256   8037b6ac 6fd0c0cc S /system/bin/debuggerd
root      2227  1     83416  27164 800e9ea4 6fd0b844 S zygote
media     2228  1     26844  5836  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 2229  1     1268   700   800e9ea4 6fd0c59c S /system/bin/dbus-daemon
root      2230  1     824    332   803fd98c 6fd0b45c S /system/bin/installd
keystore  2231  1     1752   424   8037b6ac 6fd0c0cc S /system/bin/keystore
radio     2232  1     5460   700   ffffffff 6fd0bdac S /system/bin/rild
system    2287  2227  189828 37796 ffffffff 6fd0b6fc S system_server
root      2297  2     0      0     8007cacc 00000000 S z1xx_workq
app_17    2443  2227  99264  19128 ffffffff 6fd0c51c S com.android.inputmethod.latin
radio     2449  2227  109920 20808 ffffffff 6fd0c51c S com.android.phone
system    2452  2227  129248 20960 ffffffff 6fd0c51c S com.android.systemui
app_16    2511  2227  97820  22068 ffffffff 6fd0c51c S com.android.launcher
app_1     2531  2227  103736 22144 ffffffff 6fd0c51c S android.process.acore
app_11    2555  2227  105400 17684 ffffffff 6fd0c51c S com.android.mms
app_12    2560  2227  93812  18940 ffffffff 6fd0c51c S android.process.media
app_20    2583  2227  94652  17988 ffffffff 6fd0c51c S com.android.email
app_21    2597  2227  93136  16192 ffffffff 6fd0c51c S com.android.deskclock
app_26    2611  2227  92336  16512 ffffffff 6fd0c51c S com.android.providers.calendar
app_30    2623  2227  92372  16300 ffffffff 6fd0c51c S com.android.bluetooth
app_19    2630  2227  93468  16576 ffffffff 6fd0c51c S com.cooliris.media
app_5     2643  2227  92172  15680 ffffffff 6fd0c51c S com.android.quicksearchbox
app_7     2650  2227  91804  14852 ffffffff 6fd0c51c S com.android.protips
app_10    2672  2227  92340  15000 ffffffff 6fd0c51c S com.android.music


To this:

system    2222  1     816    272   80343750 6fd0b6fc S /system/bin/servicemanager
root      2223  1     3872   588   ffffffff 6fd0bdac S /system/bin/vold
root      2224  1     3872   576   ffffffff 6fd0bdac S /system/bin/netd
root      2225  1     820    320   800e9ea4 6fd0b844 S /system/bin/dispd
root      2226  1     676    256   8037b6ac 6fd0c0cc S /system/bin/debuggerd
root      2227  1     83416  27160 800e9ea4 6fd0b844 S zygote
media     2228  1     24364  5320  ffffffff 6fd0b6fc S /system/bin/mediaserver
bluetooth 2229  1     1264   564   800e9ea4 6fd0c59c S /system/bin/dbus-daemon
root      2230  1     824    336   803fd98c 6fd0b45c S /system/bin/installd
keystore  2231  1     1752   424   8037b6ac 6fd0c0cc S /system/bin/keystore
radio     2232  1     4444   672   ffffffff 6fd0bdac S /system/bin/rild
system    2287  2227  183728 38644 ffffffff 6fd0b6fc S system_server
root      2297  2     0      0     8007cacc 00000000 S z1xx_workq
app_1     2355  2227  93116  17356 ffffffff 6fd0c51c S com.android.inputmethod.pinyin
system    2359  2227  146036 20748 ffffffff 6fd0c51c S com.android.systemui
app_16    2365  2227  96320  21116 ffffffff 6fd0c51c S com.android.launcher
app_12    2442  2227  94692  17864 ffffffff 6fd0c51c S android.process.media
app_5     2453  2227  92172  15676 ffffffff 6fd0c51c S com.android.quicksearchbox
app_7     2461  2227  91804  14848 ffffffff 6fd0c51c S com.android.protips

I know, I know, there are still a lot of processes to cut, like mediaserver, inputmethod.pinyin, launcher, media, quqicksearchbox, etc. However, the point I'm making is that with just minor modifications the system footprint can be reduced dramatically.

Nice.

One note to add, if you modify the files recommended in the TI link, which were:
build/target/product/core.mk
build/target/product/generic.mk
frameworks/base/services/java/com/android/server/SystemServer.java
You have to remember to make clean, then make again or the changes won't get picked up in the final build.


No comments:

Post a Comment