最近出现一些 Scudo ERROR问题,
crash err1: Scudo ERROR: misaligned pointer when deallocating address 0xf528346c
具体如下:
F DEBUG : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
08-11 11:14:33.991 12170 12170 F DEBUG : Abort message: 'Scudo ERROR: misaligned pointer when deallocating address 0xf528346c
08-11 11:14:33.991 12170 12170 F DEBUG : '
08-11 11:14:33.991 12170 12170 F DEBUG : r0 00000000 r1 00002f1d r2 00000006 r3 f0d7be88
08-11 11:14:33.991 12170 12170 F DEBUG : r4 f0d7be9c r5 f0d7be80 r6 00000422 r7 0000016b
08-11 11:14:33.991 12170 12170 F DEBUG : r8 f0d7be88 r9 f0d7be98 r10 f0d7beb8 r11 f0d7bea8
08-11 11:14:33.991 12170 12170 F DEBUG : ip 00002f1d sp f0d7be58 lr f3ac3f0d pc f3ac3f20
08-11 11:14:33.998 12170 12170 F DEBUG : backtrace:
08-11 11:14:33.998 12170 12170 F DEBUG : #00 pc 00038f20 /apex/com.android.runtime/lib/bionic/libc.so (abort+172) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-11 11:14:33.998 12170 12170 F DEBUG : #01 pc 0002e823 /apex/com.android.runtime/lib/bionic/libc.so (scudo::die()+2) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-11 11:14:33.998 12170 12170 F DEBUG : #02 pc 0002ec2d /apex/com.android.runtime/lib/bionic/libc.so (scudo::ScopedErrorReport::~ScopedErrorReport()+16) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-11 11:14:33.998 12170 12170 F DEBUG : #03 pc 0002edfb /apex/com.android.runtime/lib/bionic/libc.so (scudo::reportMisalignedPointer(scudo::AllocatorAction, void*)+46) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-11 11:14:33.998 12170 12170 F DEBUG : #04 pc 0002fa85 /apex/com.android.runtime/lib/bionic/libc.so (scudo::Allocator::deallocate(void*, scudo::Chunk::Origin, unsigned long, unsigned long)+232) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-11 11:14:33.998 12170 12170 F DEBUG : #05 pc 0002f98f /apex/com.android.runtime/lib/bionic/libc.so (scudo_free+18) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-11 11:14:33.998 12170 12170 F DEBUG : #06 pc 00025755 /vendor/lib/[email protected] (android::hardware::camera::device::V3_4::implementation::ExternalCameraDeviceSession::fillCaptureResult(android::hardware::camera::common::V1_0::helper::CameraMetadata&, long long, unsigned int)+228) (BuildId: c1de7995d3f833808f758b58bde736b1)
08-11 11:14:33.998 12170 12170 F DEBUG : #07 pc 00025139 /vendor/lib/[email protected] (android::hardware::camera::device::V3_4::implementation::ExternalCameraDeviceSession::processCaptureResult(std::__1::shared_ptr&)+176) (BuildId: c1de7995d3f833808f758b58bde736b1)
08-11 11:14:33.998 12170 12170 F DEBUG : #08 pc 00023fe5 /vendor/lib/[email protected] (android::hardware::camera::device::V3_4::implementation::ExternalCameraDeviceSession::MotOutputThread::threadLoop()+1252) (BuildId: c1de7995d3f833808f758b58bde736b1)
08-11 11:14:33.998 12170 12170 F DEBUG : #09 pc 0000edc9 /apex/com.android.vndk.v30/lib/libutils.so (android::Thread::_threadLoop(void*)+304) (BuildId: b5ae1bcebf1a17dc920028b3ac73b8d4)
08-11 11:14:33.998 12170 12170 F DEBUG : #10 pc 0000e881 /apex/com.android.vndk.v30/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+264) (BuildId: b5ae1bcebf1a17dc920028b3ac73b8d4)
08-11 11:14:33.998 12170 12170 F DEBUG : #11 pc 0008156b /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-11 11:14:33.998 12170 12170 F DEBUG : #12 pc 0003a42d /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-11 11:14:34.095 0 0 D logd : logdr: UID=1047 GID=1005 PID=12170 n tail=50 logMask=8 pid=1058 start=0ns timeout=0ns
crash err2: Scudo ERROR: corrupted chunk header at address 0xf0601fc0
08-12 13:25:42.028 29226 29226 F DEBUG : Abort message: 'Scudo ERROR: corrupted chunk header at address 0xf0601fc0
08-12 13:25:42.028 29226 29226 F DEBUG : '
08-12 13:25:42.028 29226 29226 F DEBUG : r0 00000000 r1 00007163 r2 00000006 r3 efcfaf18
08-12 13:25:42.028 29226 29226 F DEBUG : r4 efcfaf2c r5 efcfaf10 r6 00006cda r7 0000016b
08-12 13:25:42.028 29226 29226 F DEBUG : r8 efcfaf18 r9 efcfaf28 r10 efcfaf48 r11 efcfaf38
08-12 13:25:42.028 29226 29226 F DEBUG : ip 00007163 sp efcfaee8 lr f0e79f0d pc f0e79f20
08-12 13:25:42.039 29226 29226 F DEBUG : backtrace:
08-12 13:25:42.039 29226 29226 F DEBUG : #00 pc 00038f20 /apex/com.android.runtime/lib/bionic/libc.so (abort+172) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-12 13:25:42.039 29226 29226 F DEBUG : #01 pc 0002e823 /apex/com.android.runtime/lib/bionic/libc.so (scudo::die()+2) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-12 13:25:42.040 29226 29226 F DEBUG : #02 pc 0002ec2d /apex/com.android.runtime/lib/bionic/libc.so (scudo::ScopedErrorReport::~ScopedErrorReport()+16) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-12 13:25:42.040 29226 29226 F DEBUG : #03 pc 0002ecaf /apex/com.android.runtime/lib/bionic/libc.so (scudo::reportHeaderCorruption(void*)+34) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-12 13:25:42.040 29226 29226 F DEBUG : #04 pc 0002fa8b /apex/com.android.runtime/lib/bionic/libc.so (scudo::Allocator::deallocate(void*, scudo::Chunk::Origin, unsigned long, unsigned long)+238) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-12 13:25:42.040 29226 29226 F DEBUG : #05 pc 0002f98f /apex/com.android.runtime/lib/bionic/libc.so (scudo_free+18) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-12 13:25:42.040 29226 29226 F DEBUG : #06 pc 00023fe9 /vendor/lib/[email protected] (android::hardware::camera::device::V3_4::implementation::ExternalCameraDeviceSession::MotOutputThread::threadLoop()+616) (BuildId: 17b4eec5467db312d99b3c0a246b7c14)
08-12 13:25:42.040 29226 29226 F DEBUG : #07 pc 0000edc9 /apex/com.android.vndk.v30/lib/libutils.so (android::Thread::_threadLoop(void*)+304) (BuildId: b5ae1bcebf1a17dc920028b3ac73b8d4)
08-12 13:25:42.040 29226 29226 F DEBUG : #08 pc 0000e881 /apex/com.android.vndk.v30/lib/libutils.so (thread_data_t::trampoline(thread_data_t const*)+264) (BuildId: b5ae1bcebf1a17dc920028b3ac73b8d4)
08-12 13:25:42.040 29226 29226 F DEBUG : #09 pc 0008156b /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+40) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
08-12 13:25:42.040 29226 29226 F DEBUG : #10 pc 0003a42d /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: ae2fd0e1e31670d9e270e2c7d3e3c5a7)
刚开始以为是sp智能指针导致,经过分析定位,发现调用的std::list导致的, 当把list换成vector或者queue时,所有内存泄漏的问题都消失了。从网上找到一些答案。
得知List并没有真正导致内存泄漏,而是VS本身的 _CrtDumpMemoryLeaks()函数的执行位置的问题。
参考下如下的链接分析:
(15条消息) STL里list、vector、queue性能差异与疑似内存泄漏问题_lsldd的专栏-CSDN博客_list queue 效率