This is the magic incantation I use to use with valgrind.

valgrind --tool=memcheck --db-attach=yes --vex-iropt-precise-memory-exns=yes --leak-check=full --num-callers=40

the --vex-iropt-precise-memory-exns=yes is important for running racket.

Kevin

On 02/29/2012 10:29 PM, Simon Haines wrote:
I'm coming across a segfault when using racket 5.2.1 in some particular circumstances.

Here is a sample to reproduce the problem:
#!/home/simon/racket/bin/racket
#lang racket/base
(display "This is a test, designed to provoke an emotional response")

When I chmod +x and run it, it runs just fine:
$ /home/simon/racket/bin/racket -v
Welcome to Racket v5.2.1.
$ ./test.rkt
This is a test, designed to provoke an emotional response

Running under valgrind segfaults the process:
$ valgrind ./test.rkt
==19366== Memcheck, a memory error detector
==19366== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==19366== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==19366== Command: ./test.rkt
==19366==
==19366== Invalid read of size 8
==19366== at 0x5DD34D: scheme_longjmpup (in /home/simon/racket/bin/racket) ==19366== by 0x4402CD: scheme_handle_stack_overflow (in /home/simon/racket/bin/racket) ==19366== by 0x478DD0: overflow_equal_hash_key (in /home/simon/racket/bin/racket) ==19366== by 0x47D63A: equal_hash_key (in /home/simon/racket/bin/racket) ==19366== by 0x47DB39: scheme_equal_hash_key (in /home/simon/racket/bin/racket) ==19366== by 0x51147E: make_hash_indices_for_equal (in /home/simon/racket/bin/racket)
==19366==    by 0x479476: get_bucket (in /home/simon/racket/bin/racket)
==19366== by 0x47AF1E: scheme_lookup_in_table (in /home/simon/racket/bin/racket) ==19366== by 0x5FB742: scheme_make_prefab_struct_type_raw (in /home/simon/racket/bin/racket) ==19366== by 0x5FE5F8: scheme_lookup_prefab_type (in /home/simon/racket/bin/racket) ==19366== by 0x621408: scheme_init_thread_places (in /home/simon/racket/bin/racket) ==19366== by 0x42DBB4: place_instance_init (in /home/simon/racket/bin/racket)
==19366==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
==19366==
SIGSEGV MAPERR si_code 1 fault on addr 0x8
==19366==
==19366== HEAP SUMMARY:
==19366==     in use at exit: 8,554,151 bytes in 1,497 blocks
==19366== total heap usage: 1,507 allocs, 10 frees, 8,567,479 bytes allocated
==19366==
==19366== LEAK SUMMARY:
==19366==    definitely lost: 16,680 bytes in 4 blocks
==19366==    indirectly lost: 0 bytes in 0 blocks
==19366==      possibly lost: 576 bytes in 2 blocks
==19366==    still reachable: 8,536,895 bytes in 1,491 blocks
==19366==         suppressed: 0 bytes in 0 blocks
==19366== Rerun with --leak-check=full to see details of leaked memory
==19366==
==19366== For counts of detected and suppressed errors, rerun with: -v
==19366== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 2 from 2)
zsh: killed     valgrind ./test.rkt

I first came across this issue trying to run racket under apache, where I suspect the process was being killed off due to its memory usage. Is that 8mb of heap allocation usual for a racket/base process? Should I file a bug or is there something wrong with my setup?
Thanks.




____________________
   Racket Users list:
   http://lists.racket-lang.org/users

____________________
  Racket Users list:
  http://lists.racket-lang.org/users

Reply via email to