Re: C++ SEGMENT fault and vtable issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 14 October 2012 20:29, Arthur Schwarz wrote:
> Product Version = NetBeans IDE 7.2 (Build 201207171143)
> Operating System = Windows 7 version 6.1 running on x86
> Java; VM; Vendor = 1.7.0_03
> Runtime = Java HotSpot(TM) Client VM 22.1-b02

I doubt your IDE or JVM is relevant.


> Cygwin gcc 4.5.3
>              gdb 4.5.3
>
> I have a problem with my C++ application. I have tried to find what is wrong in
> my code and am unsuccessful, and amm hping that you can identify the issue.
>
> The code fails (for different reasons) in two locations:
> [code]
>   SlipHeader* oldHeader;
>    delete oldHeader;     // SEGMENT fault; custom defined delete
>
>   SlipHeader* header;
>   stringstream pretty;
>   pretty << header->toString(); // call to pure virtual function
> [/code]

Clearly this isn't the real code, because oldHeader and header are
never initialized.  If you show the real code, preferably reduced to
the minimum necessary to demonstrate the problem, then someone might
be able to suggest where to look for the bug.

It sounds like using an object after it's been deleted or some other
memory/lifetime issue.  On GNU/Linux I'd use valgrind to check for
that sort of problem.  There are tools to do a similar job on Windows,
but the only one I've tried is far inferior to valgrind and isn't free
(as in beer or freedom) so I won't recommend it.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux