bug,怎么调试?

时间:2011-08-06 09:43:30

标签: debugging mono opencl

我的应用程序突然中断,甚至没有显示托管堆栈跟踪。它在控制台中显示以下消息:

mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xac5ac2c0) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
mono(6417,0xb0307000) malloc: *** mmap(size=16777216) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug

Native stacktrace:

    0   mono                                0x000b6ea9 mono + 745129
    1   mono                                0x00006e23 mono + 24099
    2   libsystem_c.dylib                   0x9487c59b _sigtramp + 43
    3   ???                                 0xffffffff 0x0 + 4294967295
    4   libclh.dylib                        0x9776bbbb libclh.dylib + 191419
    5   libclh.dylib                        0x97773564 libclh.dylib + 222564
    6   libclh.dylib                        0x977b0456 clhFenceCreate + 38
    7   GeForceGLDriver                     0x8f0dca23 glrCompExecuteKernel + 5034
    8   OpenCL                              0x9a691ff1 processExec + 506
    9   OpenCL                              0x9a696ec6 processWork + 214
    10  libdispatch.dylib                   0x9282f80b _dispatch_queue_drain + 224
    11  libdispatch.dylib                   0x9282f6b0 _dispatch_queue_invoke + 47
    12  libdispatch.dylib                   0x9282eeb8 _dispatch_worker_thread2 + 187
    13  libsystem_c.dylib                   0x94826b24 _pthread_wqthread + 346
    14  libsystem_c.dylib                   0x948286fe start_wqthread + 30

Debug info from gdb:

/tmp/mono-gdb-commands.DNbmkH:1: Error in sourced command file:
unable to debug self

=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

似乎问题出在OpenCL驱动程序中。我如何追踪并解决问题?

3 个答案:

答案 0 :(得分:0)

它看起来更像是在OpenCL中发生的(注意'C',这不是OpenGL,但与它有关系)。可能会发生的是,你的程序试图将一些GPU内存映射到它的地址空间,但这会失败,因为没有留下任何地址空间,这个地址空间足够大且具有正确的对齐方式。在低级代码中的某处,不检查mmap返回的指针,这会导致段错误。

这显然是Mono或OpenCL / OpenGL驱动程序或其绑定中的错误。将上述跟踪发送给任一开发人员,提交错误问题。

答案 1 :(得分:0)

互操作中存在内存泄漏问题,导致所有可用内存耗尽,超过2gb时崩溃...所以感谢大家,我的错...

答案 2 :(得分:0)

这是CALayer上下文中大量内存分配的问题,每次更改视图时都需要释放该层。它发生在我身上,这就是我解决它的方式,每次更改绘制特定上下文的页面时都需要释放内存。