[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: I get a segmentation fault if I dont use printf
From: |
Bernd Strieder |
Subject: |
Re: I get a segmentation fault if I dont use printf |
Date: |
Wed, 07 Jun 2006 10:43:16 +0200 |
User-agent: |
KNode/0.10.2 |
aamir wrote:
>
>> You have an error on line 42. What is your program doing? Post some
>> sample code.
>
> LOL. In fact my program is about more than 6000 lines and I really
> don't know which part may have the problem but I am quite surprised
> that it runs normally if i put a printf statement.
It is bad luck, that it does not crash with the printf, too.
>
> Anyways, after using a debugger it showed me some memory leaks but I
> am unable to understand this one. Debugger message is
Try to find a minimal example producing the crash, then check if results
are exactly what you expect, manually.
> Do you get some idea of where the error may be?
My guess is, other parts of your structures are not initialized,
especially the Left and Right pointers are hot candidates, write a
function to visualize the tree and check, whether the tree always is as
expected. Basically a debugger should do this, but in our real world
this is not really viable, even DDD (data display debugger) does not
make this a pleasure.
Bernd Strieder