我正在編寫一個Android應用程序,通過OpenGL ES在本機端進行圖形渲染。當我在調試模式下編譯它時,應用程序崩潰,但不要在發佈模式下。我發現只有在設置渲染器時纔會發生這種情況,就在它完成對(onSurfaceCreated
)函數的調用時。發生的其他事情是當我在XXXActivity.nativeSurfaceCreated();
行中放置一個斷點時,即使我沒有進入,只是繼續正常的程序流程,那麼它根本不會崩潰。似乎有一個線程同步問題,但我不知道如何解決它。致命信號11(SIGSEGV),代碼1,故障地址0x61在tid 7061(GLThread 42829)
這裏是我的渲染器類
public class Renderer implements GLSurfaceView.Renderer {
public Renderer(Context ctx)
{
}
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
XXXActivity.nativeSurfaceCreated();
}
public void onSurfaceChanged(GL10 gl, int w, int h) {
XXXActivity.nativeSurfaceChanged(w, h); //HERE is the problem just when it finish the execution of this line.
}
public void onDrawFrame(GL10 gl) {
XXXActivity.nativeDrawFrame();
}
}
這裏是我的籌碼:
F/art (26519): art/runtime/mirror/object.cc:190] Invalid state during hashcode ForwardingAddress
F/art (26519): art/runtime/runtime.cc:284] Runtime aborting --- recursively, so no thread-specific detail!
F/art (26519): art/runtime/runtime.cc:284]
--------- beginning of crash
F/libc (26519): Fatal signal 6 (SIGABRT), code -6 in tid 26533 (HeapTrimmerDaem)
I/DEBUG ( 299): [2016-09-28 10:42:59.064]
I/DEBUG ( 299): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 299): Build fingerprint: 'lge/w7_tmo_us/w7:5.0.2/LRX22G/150651744a25e:user/release-keys'
I/DEBUG ( 299): Revision: '6'
I/DEBUG ( 299): ABI: 'arm'
I/DEBUG ( 299): pid: 26519, tid: 26533, name: HeapTrimmerDaem >>> com.XXX.ar.XXX <<<
I/DEBUG ( 299): signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
W/NativeCrashListener( 972): Couldn't find ProcessRecord for pid 1530015793
I/DEBUG ( 299): Abort message: 'art/runtime/gc/collector/semi_space-inl.h:37] Check failed: IsAligned<kPageSize>(obj) '
E/DEBUG ( 299): AM write failure (32/Broken pipe)
I/DEBUG ( 299): r0 00000000 r1 000067a5 r2 00000006 r3 00000000
I/DEBUG ( 299): r4 a452edd8 r5 00000006 r6 00000002 r7 0000010c
I/DEBUG ( 299): r8 00000001 r9 b78f2f48 sl b7eabab0 fp b81c5550
I/DEBUG ( 299): ip 000067a5 sp a452e288 lr b6ec57f5 pc b6eed344 cpsr 60070010
I/DEBUG ( 299):
I/DEBUG ( 299): backtrace:
I/DEBUG ( 299): #00 pc 0003b344 /system/lib/libc.so (tgkill+12)
I/DEBUG ( 299): #01 pc 000137f1 /system/lib/libc.so (pthread_kill+52)
I/DEBUG ( 299): #02 pc 00014403 /system/lib/libc.so (raise+10)
I/DEBUG ( 299): #03 pc 00010c55 /system/lib/libc.so (__libc_android_abort+36)
I/DEBUG ( 299): #04 pc 0000f3f4 /system/lib/libc.so (abort+4)
I/DEBUG ( 299): #05 pc 00226ccf /system/lib/libart.so (art::Runtime::Abort()+170)
I/DEBUG ( 299): #06 pc 000a6c59 /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
I/DEBUG ( 299): #07 pc 001efbb3 /system/lib/libart.so (art::mirror::Object::IdentityHashCode() const+390)
I/DEBUG ( 299): #08 pc 001f4223 /system/lib/libart.so (art::Monitor::DescribeWait(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread const*)+306)
I/DEBUG ( 299): #09 pc 00234627 /system/lib/libart.so (art::StackDumpVisitor::VisitFrame()+358)
I/DEBUG ( 299): #10 pc 0022e8ad /system/lib/libart.so (art::StackVisitor::WalkStack(bool)+272)
I/DEBUG ( 299): #11 pc 00236d69 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+224)
I/DEBUG ( 299): #12 pc 0023fc1d /system/lib/libart.so (art::ThreadList::DumpLocked(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+120)
I/DEBUG ( 299): #13 pc 00226a2d /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+272)
I/DEBUG ( 299): #14 pc 00226c77 /system/lib/libart.so (art::Runtime::Abort()+82)
I/DEBUG ( 299): #15 pc 000a6c59 /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
I/DEBUG ( 299): #16 pc 0012d2f1 /system/lib/libart.so (art::gc::collector::BitmapSetSlowPathVisitor::operator()(art::mirror::Object const*) const+160)
I/DEBUG ( 299): #17 pc 0012f5cf /system/lib/libart.so (void art::mirror::Object::VisitReferences<true, (art::VerifyObjectFlags)0, art::gc::collector::SemiSpaceMarkObjectVisitor, art::gc::collector::SemiSpaceMarkObjectVisitor>(art::gc::collector::SemiSpaceMarkObjectVisitor const&, art::gc::collector::SemiSpaceMarkObjectVisitor const&)+1122)
I/DEBUG ( 299): #18 pc 0013061b /system/lib/libart.so (art::gc::collector::SemiSpace::ProcessMarkStack()+126)
I/DEBUG ( 299): #19 pc 001307a9 /system/lib/libart.so (art::gc::collector::SemiSpace::MarkReachableObjects()+324)
I/DEBUG ( 299): #20 pc 00130beb /system/lib/libart.so (art::gc::collector::SemiSpace::MarkingPhase()+370)
I/DEBUG ( 299): #21 pc 0012e479 /system/lib/libart.so (art::gc::collector::SemiSpace::RunPhases()+480)
I/DEBUG ( 299): #22 pc 00121e37 /system/lib/libart.so (art::gc::collector::GarbageCollector::Run(art::gc::GcCause, bool)+246)
I/DEBUG ( 299): #23 pc 00134657 /system/lib/libart.so (art::gc::Heap::Compact(art::gc::space::ContinuousMemMapAllocSpace*, art::gc::space::ContinuousMemMapAllocSpace*, art::gc::GcCause)+58)
I/DEBUG ( 299): #24 pc 00138fa3 /system/lib/libart.so (art::gc::Heap::PerformHomogeneousSpaceCompact()+1818)
I/DEBUG ( 299): #25 pc 0013fcc7 /system/lib/libart.so (art::gc::Heap::DoPendingTransitionOrTrim()+818)
I/DEBUG ( 299): #26 pc 0001bd93 /system/framework/arm/boot.oat
I/DEBUG ( 299):
I/DEBUG ( 299): Tombstone written to: /data/tombstones/tombstone_05
I/BootReceiver( 972): Copying /data/tombstones/tombstone_05 to DropBox (SYSTEM_TOMBSTONE)
I/Zygote ( 325): Process 26519 exited due to signal (6)
這裏回溯追蹤
********** Crash dump: **********
Build fingerprint: 'lge/w7_tmo_us/w7:5.0.2/LRX22G/150651744a25e:user/release-keys'
pid: 26519, tid: 26533, name: HeapTrimmerDaem >>> com.XXX.ar.XXX <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
Stack frame #00 pc 0003b344 /system/lib/libc.so (tgkill+12)
Stack frame #01 pc 000137f1 /system/lib/libc.so (pthread_kill+52)
Stack frame #02 pc 00014403 /system/lib/libc.so (raise+10)
Stack frame #03 pc 00010c55 /system/lib/libc.so (__libc_android_abort+36)
Stack frame #04 pc 0000f3f4 /system/lib/libc.so (abort+4)
Stack frame #05 pc 00226ccf /system/lib/libart.so (art::Runtime::Abort()+170)
Stack frame #06 pc 000a6c59 /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
Stack frame #07 pc 001efbb3 /system/lib/libart.so (art::mirror::Object::IdentityHashCode() const+390)
Stack frame #08 pc 001f4223 /system/lib/libart.so (art::Monitor::DescribeWait(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, art::Thread const*)+306)
Stack frame #09 pc 00234627 /system/lib/libart.so (art::StackDumpVisitor::VisitFrame()+358)
Stack frame #10 pc 0022e8ad /system/lib/libart.so (art::StackVisitor::WalkStack(bool)+272)
Stack frame #11 pc 00236d69 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+224)
Stack frame #12 pc 0023fc1d /system/lib/libart.so (art::ThreadList::DumpLocked(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+120)
Stack frame #13 pc 00226a2d /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+272)
Stack frame #14 pc 00226c77 /system/lib/libart.so (art::Runtime::Abort()+82)
Stack frame #15 pc 000a6c59 /system/lib/libart.so (art::LogMessage::~LogMessage()+1360)
Stack frame #16 pc 0012d2f1 /system/lib/libart.so (art::gc::collector::BitmapSetSlowPathVisitor::operator()(art::mirror::Object const*) const+160)
Stack frame #17 pc 0012f5cf /system/lib/libart.so (void art::mirror::Object::VisitReferences<true, (art::VerifyObjectFlags)0, art::gc::collector::SemiSpaceMarkObjectVisitor, art::gc::collector::SemiSpaceMarkObjectVisitor>(art::gc::collector::SemiSpaceMarkObjectVisitor const&, art::gc::collector::SemiSpaceMarkObjectVisitor const&)+1122)
Stack frame #18 pc 0013061b /system/lib/libart.so (art::gc::collector::SemiSpace::ProcessMarkStack()+126)
Stack frame #19 pc 001307a9 /system/lib/libart.so (art::gc::collector::SemiSpace::MarkReachableObjects()+324)
Stack frame #20 pc 00130beb /system/lib/libart.so (art::gc::collector::SemiSpace::MarkingPhase()+370)
Stack frame #21 pc 0012e479 /system/lib/libart.so (art::gc::collector::SemiSpace::RunPhases()+480)
Stack frame #22 pc 00121e37 /system/lib/libart.so (art::gc::collector::GarbageCollector::Run(art::gc::GcCause, bool)+246)
Stack frame #23 pc 00134657 /system/lib/libart.so (art::gc::Heap::Compact(art::gc::space::ContinuousMemMapAllocSpace*, art::gc::space::ContinuousMemMapAllocSpace*, art::gc::GcCause)+58)
Stack frame #24 pc 00138fa3 /system/lib/libart.so (art::gc::Heap::PerformHomogeneousSpaceCompact()+1818)
Stack frame #25 pc 0013fcc7 /system/lib/libart.so (art::gc::Heap::DoPendingTransitionOrTrim()+818)
Stack frame #26 pc 0001bd93 /system/framework/arm/boot.oat
你應該標記這個java而不是C++。 –