[fpc-pascal] FPC + valgrind massif problems

Ludo Brands ludo.brands at free.fr
Fri May 11 10:16:34 CEST 2012


> Hi,
> 
> I wanted to debug where my program uses the most memory. 
> (There are no 
> memory leaks, but I want to optimize memory usage on some 
> large inputs. 
> As the code is quite large, simply guessing which part is responsible 
> becomes quite hard :) In the past, I happily used valgrind's 
> massif tool 
> for such job, and it worked like a charm. But now, FPC 2.6.0 with 
> valgrind 3.7.0, it seems valgrind/massif has problems:
> 
> $ fpc -gv trivial_alloc.pas
> $ valgrind --tool=massif ./trivial_alloc
> ....
> --7286-- VALGRIND INTERNAL ERROR: Valgrind received a signal 11 
> (SIGSEGV) - exiting
> --7286-- si_code=1;  Faulting address: 0xFFFFFFF7;  sp: 0x6298914c
> valgrind: the 'impossible' happened:
>     Killed by fatal signal
> 
> (Full output and trivial_alloc.pas attached.)
> 
> The code is compiled with -gv option. It works very fine with 
> valgrind's 
> callgrind tool. So I suspect this is a problem with valgrind, 
> specifically massif, not related to FPC. Also, it seems to 
> fail the same 
> way with older/newer FPC versions (I tried 2.2.4, 2.4.4, 2.6.0, and 
> 2.7.1 from today 2012-05-11). Probably, some valgrind version broke 
> massif for FPC binaries.
> 
> So, questions:
> 
> 1. I want to report this as massif's bug. Any ideas what more 
> information should I provide to valgrind's developers? I 
> don't know if 
> they are familiar with FPC. And simple C examples work fine, so it's 
> probably something specific in FPC binaries.
> 
> - Maybe this problem is already reported?
> 
> - Maybe there's a workaround? IOW, can someone successfully 
> use massif 
> with FPC programs?
> 

This is known problem not related to fpc. Run 

valgrind --tool=massif --run-libc-freeres=no  ./trivial_alloc

Ludo




More information about the fpc-pascal mailing list