[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: g++ usage of new generates a segmentation fault
From: |
Christophe Limbrée |
Subject: |
Re: g++ usage of new generates a segmentation fault |
Date: |
14 Jul 2006 00:59:34 -0700 |
User-agent: |
G2/0.2 |
Paul Pluzhnikov a écrit :
> You have a bug, and valgrind will likely show it to you immediately,
> so why don't you stop wasting time hypothesisizing what the problem
> might be, and use proper tools to find it.
Valgring said:
==16807== LEAK SUMMARY:
==16807== definitely lost: 0 bytes in 0 blocks.
==16807== possibly lost: 0 bytes in 0 blocks.
==16807== still reachable: 35182 bytes in 15 blocks.
==16807== suppressed: 0 bytes in 0 blocks.
Segmentation fault
Do I have to understand that there is no problem?
And before
==16807== Use of uninitialised value of size 4
==16807== at 0x8049217: main (in /home/lch/SRC/TCOV/ECXX/ecxx)
==16807==
==16807== Process terminating with default action of signal 11
(SIGSEGV)
==16807== Bad permissions for mapped region at address 0x804A8BA
==16807== at 0x8049217: main (in /home/lch/SRC/TCOV/ECXX/ecxx)
==16807==
==16807== ERROR SUMMARY: 41 errors from 19 contexts (suppressed: 0 from
0)
==16807== malloc/free: in use at exit: 35182 bytes in 15 blocks.
==16807== malloc/free: 60 allocs, 45 frees, 39789 bytes allocated.
==16807== For counts of detected errors, rerun with: -v
==16807== searching for pointers to 15 not-freed blocks.
==16807== checked 1276260 bytes.
And finally I have no idea where the fault can be. The fact is that if
I use myclass instance(param, ...), I don't have the problem. If I use
myclass *instance = new myclass(param, ...), I have the problem. Maybe
because I link a .o that I have created.
Re: g++ usage of new generates a segmentation fault, Paul Pluzhnikov, 2006/07/11