I have a difficult memory error to find. I have narrowed it
down to a small piece of code, tiny in fact, but the symptoms
are baffling to me. I tried to find it with electric fence, but
electric fence found nothing. The problem is complicated by
my liberal use of the STL, in particular deques and maps.
I have written a large bit of calibration code that works
satisfactorily. I am now embedding it into a production system
which is to run nightly. The production system has a pointer to
the calibration class, which gets initialized to zero in the constructor,
and then is set equal to new CalibratorClass(...) after some
(substantial) calculations are done in another function.
The calculations are done successfully, and the pointer is
initialized pointing to new, healthy-looking (in the debugger)
CalibratorClass. Near the beginning of the next function call,
a member function of this class is called (it initializes some more of
the data members). The instance of the CalibratorClass looks healthy
right up until the call. However, once we step inside, the class
is corrupted. The reason is that the "this" pointer does NOT correspond
to the healthy looking object I examined the line before, but is
a completely different pointer. Somehow at the function call
the "this" pointer got changed.
Can anyone suggest an avenue to explore, here? The only things I can
think of, here, are that the vtable got corrupted, but this member
function isn't virtual. My next step is to try Rational Purify, but
it looks VERY expensive (~$6000). Are there any other free/cheap
memory-error finders anyone can recommend? Does this symptom
sound like anything familiar?