|
From: Richard C. <ric...@pr...> - 2005-09-21 11:09:00
|
Problem solved!!!!!
I've now found the cause of the problem - and I offer my sins up to you
in order to see if I could have used valgrind in a way which would have
caught the problem.
I have a cache for a routine, which used a hash based on a memory
location to see if it had already handled that particular item before.
The code was:
int getKey (); // returns &m_data or something similar
const int cache_size = 127;
static CacheType cache[cache_size];
int entry = (getKey () >> 2) % cache_size;
if (cache[entry] != 0) { ... }
The code didn't fail in valgrind as '&m_data' must always be less than
INT_MAX. However, when running on the machine normally, sometimes
m_data was above INT_MAX and so 'entry' was negative.
It might be asking a lot to have valgrind catch this - but I am
overjoyed that I've finally found the issue!
All the best!
Richard
Richard Corden wrote:
>
> Hi,
>
> One of our tools fails some tests on one of our machines. The
> failures are consistent and reproducible, they are seg 11s, and in
> some cases I get a message from glibc.
>
> *** glibc detected *** free(): invalid pointer: 0x082587f4 ***
>
> These messages always have the same memory address.
>
> The interesting thing is that when I run the same test with valgrind,
> I don't get any failures, and the tools pass the test as expected.
> Initially 'valgrind' found a 'memcpy' with overlapping memory which is
> now fixed but other than that there were no other issues when using
> --tool=memcheck.
>
> The machine is relatively new (Intel Zeon hyper threading P4 3.2GHz)
> and I have had problems keeping it cool, I do get a lot of messages
> from syslogd about passing temperature threshold.
>
> I need to find out if it is the overheating of the CPU or ?something
> else? which causes the failure?
>
> My question is, what could valgrind be doing that might stop the
> problem from occurring?
>
> I've been running using --tool=memcheck, should I try something else?
>
>
> Regards,
>
>
> Richard
>
--
Richard Corden
Programming Research Ltd.
ric...@pr...
+ 44 845 0048478
|