【内存泄漏】【蓝牙】【必现】配对接口测试16小时发现内存泄漏问题
一:问题简要描述:
以12秒1次的速度循环调用pairBleDevice、getPairedBleDevices、cancelPairedBleDevice、getPairedBleDevices接口,测试16小时发现内存泄漏问题
二:问题详细描述:
【预置条件】:
1.系统初始化正常
2.蓝牙开启
3.对端蓝牙设备广播已开启
【测试步骤】:
1.调用pairBleDevice()接口发起蓝牙配对,验证响应结果
2.调用getPairedBleDevices()接口获取蓝牙配对列表,验证响应结果
3.调用cancelPairedBleDevice()接口删除配对的设备,验证响应结果
4.调用getPairedBleDevices()接口获取蓝牙配对列表,验证响应结果
5.以上步骤执行16小时,查看结果
【预期结果】:
1.返回true
2.返回已配对蓝牙设备的地址
3.返回true
4.返回空数组
5.无稳定性问题
【实际结果】:
1.返回true
2.返回已配对蓝牙设备的地址
3.返回true
4.返回空数组
5.出现内存泄漏问题
【问题概率】:平均每小时内存泄漏0.125M
【恢复操作】:无
3、问题分析
通过smartperf抓取分析报告,发现内存泄漏为三方库libxml2引起:
[ OHOS::BinderInvoker::HandleCommandsInner(unsigned int) ] libipc_core.z.so
[ OHOS::BinderInvoker::OnTransaction(unsigned char const*) ] libipc_core.z.so
[ libbluetooth_server.z.so+0x126438 ] libbluetooth_server.z.so
[ libbluetooth_server.z.so+0x123fd8 ] libbluetooth_server.z.so
[ OHOS::Bluetooth::BluetoothHostServer::RemovePair(int, OHOS::sptr<OHOS::Bluetooth::BluetoothRawAddress> const&) ] libbluetooth_server.z.so
[ OHOS::bluetooth::BleAdapter::RemovePair(OHOS::bluetooth::RawAddress const&) ] libbtservice.z.so
[ OHOS::bluetooth::BleAdapter::RemovePairWithDisConnect(OHOS::bluetooth::RawAddress const&, bool) const ] libbtservice.z.so
[ OHOS::bluetooth::AdapterDeviceConfig::Save() ] libbtservice.z.so
[ xmlSaveFormatFileEnc ] libxml2.z.so
[ xmlOutputBufferClose ] libxml2.z.so
[ xmlOutputBufferFlush ] libxml2.z.so
[ xmlCharEncOutput ] libxml2.z.so
[ xmlBufGrow ] libxml2.z.so
[ libxml2.z.so+0x4f15e ] libxml2.z.so
[ realloc ] ld-musl-arm.so.1
AdapterDeviceConfig::Save()方法会调用libxml2库的接口,引起内存泄漏
4、日志链接
附件不支持htrace文件,也可在本地使用smartperf工具调用pairBleDevice、getPairedBleDevices、cancelPairedBleDevice、getPairedBleDevices接口复现该问题。
更多推荐
所有评论(0)