I try to profile a simple c prog using valgrind:
[zsun@nel6005001 ~]$ valgrind --tool=memcheck ./fl.out
==2238== Memcheck, a memory error dete
You are not going to be able to compute 10000!
like that. You will need some sort of bignum
implementation for computing factorials. This is because int
is "usually" 4 bytes long which means that "usually" it can hold 2^32 - 1
(signed int, 2^31
) - 13!
is more than that. Even if you used an unsigned long
("usually" 8 bytes) you'd overflow by the time you reached 21!
.
As for what it "profiling timer expired" means - it means valgrind received the signal SIGPROF
: http://en.wikipedia.org/wiki/SIGPROF (probably means your program took too long).