[Mono-devel-list] mono under valgrind gives segmentation fault

T Sureshkumar TSureshkumar at novell.com
Wed Jun 30 00:52:26 EDT 2004

   I'm trying to debug a memory leak problem using valgrind. I am
getting a segmentation fault while running just mono under valgrind.
Look at the log below for running mono.  I did some hack (driver.c:532)
giving some printf's. the printfs either do not work here, throwing
SIGSEGV, if i pass some parameters to printf. Otherwise OK.  I guess the
stack size for valgrind is not enough and it gets corrupted here. Does
anybody know answer for this problem?  That will be helpful in debugging
mono under valgrind!!

test> LANG= valgrind --tool=memcheck mono

==12075== Memcheck, a memory error detector for x86-linux.
==12075== Copyright (C) 2002-2004, and GNU GPL'd, by Julian Seward.
==12075== Using valgrind-2.1.2.CVS, a program supervision framework for
==12075== Copyright (C) 2000-2004, and GNU GPL'd, by Julian Seward.
==12075== For more details, rerun with: -v
Usage is: mono [options] assembly
Runtime and JIT debugging:
    --compile METHOD       Just compile METHOD in assembly
    --ncompile N           Number of times to compile METHOD (default:
    --regression           Runs the regression test contained in the
    --print-vtable         Print the vtable of all used classes
    --trace[=EXPR]         Enable tracing, use --help-trace for details
    --compile-all          Compiles all the methods in the assembly
    --breakonex            Inserts a breakpoint on exceptions
    --break METHOD         Inserts a breakpoint at METHOD entry
    --debug                Enable debugging support
    --stats                Print statistics about the JIT operations
    --statfile FILE        Sets the stat file to FILE
    --aot                  Compiles the assembly to native code
    --profile[=profiler]   Runs in profiling mode with the specified
profiler module
    --graph[=TYPE] METHOD  Draws a graph of the specified method:
==12075== Invalid read of size 4
==12075==    at 0x1C5BE927: _IO_vfprintf_internal (in
==12075==    by 0x1C5C7ADF: _IO_printf (in /lib/i686/libc.so.6)
==12075==    by 0x1B95E206: mini_usage (driver.c:532)
==12075==    by 0x1B95EEFF: mono_main (driver.c:709)
==12075==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==12075== Process terminating with default action of signal 11 (SIGSEGV)
==12075==  Access not within mapped region at address 0x0
==12075==    at 0x1C5BE927: _IO_vfprintf_internal (in
==12075==    by 0x1C5C7ADF: _IO_printf (in /lib/i686/libc.so.6)
==12075==    by 0x1B95E206: mini_usage (driver.c:532)
==12075==    by 0x1B95EEFF: mono_main (driver.c:709)
==12075== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 39 from
==12075== malloc/free: in use at exit: 348 bytes in 7 blocks.
==12075== malloc/free: 7 allocs, 0 frees, 348 bytes allocated.
==12075== For a detailed leak analysis,  rerun with: --leak-check=yes
==12075== For counts of detected errors, rerun with: -v
Segmentation fault

Best Regards,

More information about the Mono-devel-list mailing list