Mayank
Mayank

Reputation: 1

in free(): error: junk pointer, too high to make sense Segmentation fault: 11 (core dumped) gprof

I am trying to profile my application. For this I compiled my code with -pg and -lc_p option, it compiled successfully

During run time I am getting the following error. in free(): error: junk pointer, too high to make sense Segmentation fault: 11 (core dumped)

Doing GDB gives error as.

(gdb) b main
Breakpoint 1 at 0x5124d4:
(gdb) r
warning: Unable to get location for thread creation breakpoint: generic error
[New LWP 100085]
cacheIp in free(): error: junk pointer, too high to make sense

Program received signal SIGSEGV, Segmentation fault.
[Switching to LWP 100085]
0x00000000006c3a1f in pthread_sigmask ()

My application is multi threaded and is a combination of C and C++ code.

uname -a
FreeBSD 6.3-RELEASE FreeBSD 6.3-RELEASE #0: Wed Jan 16 01:43:02 UTC 2008    [email protected]:/usr/obj/usr/src/sys/SMP amd64

The code is working fine without the -pg option. Why is the code crashing with -pg. Am I missing something.

Upvotes: 0

Views: 792

Answers (2)

stass
stass

Reputation: 11

Valgrind certainly does work on amd64, it's a primary development platform. So running it under valgrind will certainly help.

Upvotes: 1

Paul R
Paul R

Reputation: 213080

You probably have one or more latent bugs in your code which are only manifesting themselves now that you are trying to profile with gprof. Try running your code under valgrind to flush out any bugs - fix those bugs - and then try profiling again.

Upvotes: 1

Related Questions