Re: Student requires urgent help! Debug Assertion Failed error

From: Marcin Kalicinski (kalita_at_poczta.onet.pl)
Date: 04/06/04


Date: Tue, 6 Apr 2004 13:39:48 +0200

Uzytkownik "Cormac" <boddah@csn.ul.ie> napisal w wiadomosci
news:400ce517.0404060211.59199ddf@posting.google.com...
> Hi everyone,
>
> I'm writing Pure Data externals in C++ using Ms Visual C++ 7.0 and
> Windows2000. I'm running motions sensor hardware so there's a bit of
> real time data processing involved.
>
> When I'm running my objects in Pure Data, I get an assertion failure
> after a few seconds of running the motion sensors and I can't seem to
> get rid of it. The error occurs in the expression _CrtCheckMemory().
> Could anyone provide some possible solutions?

You overwrite memory somewhere in your code. _CrtCheckMemory() in debug
builds of VC++ 7.0 checks the consistency of the heap. Because it asserts -
the heap is corrupt. The assertion message probably contains more detailed
information - i.e. where the corruption occured (but not when). In general,
tracking down this kind of bug is hard, and this is probably one of the
worst symptoms of bug you can have in C++. It's sometimes called CoreWars
:-).

It can be caused by writing outside an array, by using members of object
that has been deleted (common cause), by deleting object more than once, and
by multitude of other "undefined behavior" actions that you can do in C++.

I suggest you quickly review the code that you recently changed to determine
if you haven't introduced any pointer-related bugs. If it does not help, you
might try pinpointing down the exact address where the corruption occurs,
and check the contents of corrupt memory. Usually it will contain rubbish
(some pointers, floating point numbers etc.). You can try to identify that -
for example if it is a floating point number or a C string - you may
succeed. Then, you'll have a clue where to look for corruption source.

If this fails, you can try setting a memory-access breakpoint in this place
(Visual C++ 7.0 has this feature in IDE). You'll get debug break anytime the
memory is changed. By enabling and disabling the breakpoint in "clever" way,
provided that you have enough patience and time, you may pinpoint the moment
where the memory is actually corrupt.

<OT>
If this fails, switch to Java or C# and rewrite the project :-)
</OT>

Good luck,
Marcin



Relevant Pages

  • Re: Re: Blue screen PFN_list_corrupt
    ... > should display blue screens is if you blue screen while ... > passing bad memory descriptor lists. ... > corrupt The number of pages available 0 The list head was ...
    (microsoft.public.windowsxp.perform_maintain)
  • Re: Out of memory?
    ... Your DB is corrupt, either on disk or durring read from disk and transfer to ... The DB is cached as it is read into memory ... The fact that ntdsutil *still* can't load your database ... Directory services could not start (I suspected corrupt ntds.dit ...
    (microsoft.public.windows.server.sbs)
  • Re: My table turns gray
    ... Document is corrupt ... Computer doesn't have enough memory. ... Intel needs at least a gig of RAM to handle large tables, ...
    (microsoft.public.mac.office.word)
  • Re: usb flashkey disk copy error
    ... Now is the data corrupt still correupt ... > coping a file larger than memory size, the cmp just pulls it from memory, ... it's definitely a _read_ phenomenon - I'm creating images on ...
    (freebsd-current)