gc heap parameter

 

//frameworks/native/build/phone-hdpi-1024-dalvik-heap.mk
PRODUCT_PROPERTY_OVERRIDES += \
    dalvik.vm.heapstartsize=8m \
    dalvik.vm.heapgrowthlimit=64m \
    dalvik.vm.heapsize=128m \
    dalvik.vm.heaptargetutilization=0.75 \
    dalvik.vm.heapminfree=2m \
    dalvik.vm.heapmaxfree=8m

 

// frameworks/native/build/phone-hdpi-1024-dalvik-heap.mk
PRODUCT_PROPERTY_OVERRIDES += \
    dalvik.vm.heapstartsize=8m \       堆的起始大小
    dalvik.vm.heapgrowthlimit=192m \   堆最大大小
    dalvik.vm.heapsize=512m \          设置large heap size后最大的大小
    dalvik.vm.heaptargetutilization=0.75 \    内存使用大小/堆内存使用大小
    dalvik.vm.heapminfree=2m \         GC完后做内存扩容,保持最小有2M大小空闲空间
    dalvik.vm.heapmaxfree=8m           GC完后做内存扩容,保持最多有不能超过8M空闲空间

 

// frameworks/native/build/phone-xxhdpi-2048-dalvik-heap.mk
PRODUCT_PROPERTY_OVERRIDES += \
    dalvik.vm.heapstartsize=16m \
    dalvik.vm.heapgrowthlimit=256m \
    dalvik.vm.heapsize=512m \ 
    dalvik.vm.heaptargetutilization=0.75 \
    dalvik.vm.heapminfree=4m \
    dalvik.vm.heapmaxfree=8m 

 这些值由手机厂商决定,但是要使它生效,必须添加其它patch

target_dir = $(strip $(shell find device/htc -maxdepth 4 -name $(TARGET_PRODUCT)))
density = $(strip $(shell cat $(target_dir)/system.prop | grep ro.sf.lcd_density | cut -d "=" -f 2))
ifeq ($(findstring $(density), 160 240 320 480 640), )
density = $(strip $(shell cat $(target_dir)/../system.prop | grep ro.sf.lcd_density | cut -d "=" -f 2))
endif
# [Emulator]
ifneq ($(TARGET_PRODUCT), full)
# Not match all of below density, trigger build break
ifeq ($(findstring $(density), 160 240 320 480 640), )
$(error ro.sf.lcd_density not found in $(target_dir)/system.prop or $(target_dir)/../system.prop)
endif
endif #[Emulator]

ifeq ($(density) , 160)
PRODUCT_AAPT_CONFIG += mdpi
PRODUCT_RECOVERY_PREF_DENSITY = mdpi
#Dalvik inherit heap related settings +
$(call inherit-product, frameworks/native/build/phone-hdpi-1024-dalvik-heap.mk)
#Dalvik inherit heap related settings -
endif

ifeq ($(density) , 240)
PRODUCT_AAPT_CONFIG += hdpi mdpi
PRODUCT_RECOVERY_PREF_DENSITY = hdpi
#Dalvik inherit heap related settings +
$(call inherit-product, frameworks/native/build/phone-hdpi-1024-dalvik-heap.mk)
#Dalvik inherit heap related settings -
endif

ifeq ($(density) , 320)
PRODUCT_AAPT_CONFIG += xhdpi hdpi mdpi
PRODUCT_RECOVERY_PREF_DENSITY = xhdpi
#Dalvik inherit heap related settings +
$(call inherit-product, frameworks/native/build/phone-xhdpi-1024-dalvik-heap.mk)
#Dalvik inherit heap related settings -
endif

ifeq ($(density) , 480)
PRODUCT_AAPT_CONFIG += xxhdpi xhdpi hdpi
PRODUCT_RECOVERY_PREF_DENSITY = xxhdpi
#Dalvik inherit heap related settings +
$(call inherit-product, frameworks/native/build/phone-xhdpi-2048-dalvik-heap.mk)
#Dalvik inherit heap related settings -
endif

ifeq ($(density) , 640)
PRODUCT_AAPT_CONFIG += xxxhdpi xxhdpi xhdpi hdpi
PRODUCT_RECOVERY_PREF_DENSITY = xxxhdpi
#Dalvik inherit heap related settings +
$(call inherit-product, frameworks/native/build/phone-xxhdpi-2048-dalvik-heap.mk)
#Dalvik inherit heap related settings -
endif

 

另外,MTK也可能自己设置相关的参数,在build的时候可能会覆盖设置的参数。

那么就只能对版本做CTS测试了,去检测相关的property值。

 

posted @ 2016-03-23 21:17  牧 天  阅读(886)  评论(0编辑  收藏  举报