OMX大量内存泄漏问题分析

一、确认问题模块

参考文章:

 https://blog.csdn.net/suixin______/article/details/129330892

确认了是[email protected] 模块内存一直在消耗

03-29 02:42:57.962   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3227096
03-29 02:44:04.431   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3255112
03-29 02:45:10.925   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3255112
03-29 02:47:33.057   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 02:48:40.992   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 02:49:55.160   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3227096
03-29 02:51:04.793   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3255112
03-29 02:52:19.175   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3255112
03-29 02:53:32.437   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 02:54:47.786   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 02:56:03.374   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 02:57:17.252   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3227096
03-29 02:58:29.335   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 02:59:43.173   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 03:00:57.692   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 03:02:12.143   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 03:03:27.724   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3227096
03-29 03:04:43.395   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3227096
03-29 03:05:57.160   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3227096
03-29 03:07:11.328   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3199080
03-29 03:08:26.907   568   592 I Health@HealthMain: [email protected] (PID 931) size: 3227096

二,分析OMX模块业务,在此不再冗述。推测当时使用OMX接口的音频或者视频模块可能因为没有释放句柄、资源等造成内存泄漏。

正常LOG,OMX的关键字makeComponentInstance跟destroyComponentInstance是一一对应的。

找每份LOG中,make跟destroy数量不一致的LOG。

	OMXMaster: makeComponentInstance(0xe5a83b04)
	destroyComponentInstance(0xe5a83b04) in [email protected] process

 

三、 找到没有释放的:

	Line 522293: 03-28 18:50:13.074   931 22220 I OMXMaster: makeComponentInstance(0xe5aeb204)
	Line 522306: 03-28 18:50:13.077   931 22220 E OMXNodeInstance: getParameter(0xe5aeb204:qcom.decoder.avc, ??(0x7f000046)) ERROR: UnsupportedIndex(0x8000101a)
	Line 522314: 03-28 18:50:13.081   931  1035 E OMXNodeInstance: setConfig(0xe5aeb204:qcom.decoder.avc, ConfigPriority(0x6f800002)) ERROR: UnsupportedSetting(0x80001019)
	Line 522317: 03-28 18:50:13.081   931   931 E OMXNodeInstance: setParameter(0xe5aeb204:qcom.decoder.avc, OMX.google.android.index.allocateNativeHandle(0x7f00005d): Output:1 en=0) ERROR: UnsupportedSetting(0x80001019)
	Line 522396: 03-28 18:50:13.138   931  3258 E OMXNodeInstance: setConfig(0xe5aeb204:qcom.decoder.avc, ConfigPriority(0x6f800002)) ERROR: UnsupportedSetting(0x80001019)
	Line 522400: 03-28 18:50:13.138   931 22220 E OMXNodeInstance: setConfig(0xe5aeb204:qcom.decoder.avc, ConfigOperatingRate(0x6f800003)) ERROR: UnsupportedSetting(0x80001019)
	Line 522421: 03-28 18:50:13.157   931 22220 E OMXNodeInstance: getConfig(0xe5aeb204:qcom.decoder.avc, ??(0x7f000062)) ERROR: UnsupportedSetting(0x80001019)
	Line 522471: 03-28 18:50:13.217   931  2031 E OMXNodeInstance: setConfig(0xe5aeb204:qcom.decoder.avc, ConfigOperatingRate(0x6f800003)) ERROR: UnsupportedSetting(0x80001019)
	Line 522554: 03-28 18:50:13.255   931  1035 E OMXNodeInstance: getConfig(0xe5aeb204:qcom.decoder.avc, ??(0x7f000062)) ERROR: UnsupportedSetting(0x80001019)
	Line 522663: 03-28 18:50:13.335   931  1037 E OMXNodeInstance: getConfig(0xe5aeb204:qcom.decoder.avc, ??(0x7f000062)) ERROR: UnsupportedSetting(0x80001019)

四、往前找,是哪个模块使用了OMX:

03-28 18:50:13.012   922 22696 D NuPlayerDecoderPassThrough: [pass through decoder] onConfigure
03-28 18:50:13.013   922 22697 D NuPlayerDecoder: [video/avc decoder] onConfigure (surface=0xe9866800)
03-28 18:50:13.014   468   468 W AshmemAllocator: ashmem_create_region(262144) returning hidl_memory(0x763c82c100, 262144)
03-28 18:50:13.018   922 22699 I OMXClient: IOmx service obtained
03-28 18:50:13.018   931 22220 I OMXMaster: makeComponentInstance(OMX.qcom.video.decoder.avc) in [email protected] process

五、 nuplayer是系统内置的player,继续找调用的应用:

03-28 18:50:12.907  3173  3276 I ControllerImpl_Video: [ (ControllerImpl.java:251)#setupPlayer ] setupPlayer end.
03-28 18:50:12.907  3173  3276 I USBPlaylist: [ (Playlist.java:74)#selectSource ] selectSource: /storage/4485-B37C/new/视频

六、总结

系统service产生内训消耗,多是使用系统service接口的应用产生。先找到异常使用的地方,再从异常使用的地方往前找异常的应用。

你可能感兴趣的:(spring,linux,android)