473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Student requires urgent help! Debug Assertion Failed error

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?

Many thanks,
Cormac
Jul 22 '05 #1
6 2996
Uzytkownik "Cormac" <bo****@csn.ul.ie> napisal w wiadomosci
news:40**************************@posting.google.c om...
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

Jul 22 '05 #2
Uzytkownik "Cormac" <bo****@csn.ul.ie> napisal w wiadomosci
news:40**************************@posting.google.c om...
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

Jul 22 '05 #3
Cormac wrote:
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?

Many thanks,
Cormac


My crystal ball says that your problem is on line 123 in the
third source file. Fix that and all shall be well.

Since my crystal ball may be wrong, post the minimal compilable and
executable source code that recreates the problem. Other than that
try using "print" statements to see where the memory leak is.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #4
Cormac wrote:
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?

Many thanks,
Cormac


My crystal ball says that your problem is on line 123 in the
third source file. Fix that and all shall be well.

Since my crystal ball may be wrong, post the minimal compilable and
executable source code that recreates the problem. Other than that
try using "print" statements to see where the memory leak is.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #5
Cormac wrote:
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?


Short answer: You should have used standard containers instead of 'new'
(although this can also happen if you mis-use containers -- a good
debugging version of the standard containers helps).

Explicit memory management is a bitch, and debugging the problems that
arise from it is even worse.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #6
Cormac wrote:
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?


Short answer: You should have used standard containers instead of 'new'
(although this can also happen if you mis-use containers -- a good
debugging version of the standard containers helps).

Explicit memory management is a bitch, and debugging the problems that
arise from it is even worse.

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Mojo | last post by:
Ok, I don't want to much help but I need a push. I am supposed to write a program with 3 classes: 1. Controlling class 2. Student class 3. Grades class Controlling class instantiates a student...
17
by: Sue | last post by:
<html> Is there someone here that can help me validate the period as the fourth from the last character in an email address. There is other information and validation on the form I have to do but...
16
by: Kirk Bevins | last post by:
Hello, new to posting, got a dilema in c++. I cant seem to create new instances of my student class. The idea is to make a database where the user inputs surnames and library card numbers etc. The...
1
by: Pieter Linden | last post by:
Hi, I think the subject line pretty much says it all... Say I have a students-classes database and I add a twist. I want to filter what courses a student can take by comparing the courses he...
2
by: sallyk07 | last post by:
Modify the Student class so that each student object should also contain the scores for three tests. Provide a constructor that sets all instance values based on parameter values. Overload the...
0
by: bonkeru | last post by:
Hi all am working on a project that keeps the student records and retrieve it can anybody help with a code in vb 6.0 that can solve my problem? It is urgent please. Thanks
11
by: xxbabysue123xx | last post by:
Heres the problem: Create a class Student with instance data name, studentNumber, class (where class is a String containing one of the following: “Freshman”, “Sophomore”, “Junior”, “Senior”. ...
31
by: Warly girl | last post by:
Hi i have a qustion plz help me to understand and solve it Phase One Problem description You are required to implement a student registration system. The system keeps information about the...
21
by: farzadaumixer | last post by:
hi umm i need help in writing a program in c(or c++) here are the details: i want it to recieve "x" numbers of student id's and the average of the student in their last term and i want it to...
3
by: Synapse | last post by:
hi everyone..im trying to create a student list program using linked list that will display all my info of students..but it seems theres a little prob. after i enter my first student the program will...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.