C
cppaddict
Hi,
I've been trying to debug a strange runtime error for the last 5
hours... I'm hoping someone might have an insight about it.
I have an application that creates a vector of MyDisplay objects
(MyDisplay is a custom class) and then uses them in various ways. The
application has been compiling and running fine. Then I added a
member variable of type enum to MyDisplay. So my class def now looks
like this:
class MyDisplay {
enum DisplayType {SMALL,MEDIUM,LARGE};
private:
DisplayType _displayType;
//....
// all the rest of the def is the same as before
}
I also added a default value in the constructor initialization list:
MyDisplay::MyDisplay() : _displayType(MEDIUM),
//rest of ctor def is same as before
Those are the ONLY two changes I've made so far. The app still
compiles without error. However, it now crashes when I run it. (If I
remove those changes, it will run perfectly). In particular, it
crashes when the vector of MyDisplay objects is being created. The
code creates 10 of them in total, and it crashes after the fourth one
has been constructed and added to the vector.
However, there does not seem to be a memory overload. The app never
uses more 3.5 MG memory, and each MyDisplay adds less than
200K.
PLEASE NOTE: I know that I'm leaving many possibly relevant details
out of my description, but it would be too much to ask anyone to look
at the whole app, as its fairly large. I'm just hoping that the
description above might ring some bells for someone.
Thanks for any thoughts,
cpp
I've been trying to debug a strange runtime error for the last 5
hours... I'm hoping someone might have an insight about it.
I have an application that creates a vector of MyDisplay objects
(MyDisplay is a custom class) and then uses them in various ways. The
application has been compiling and running fine. Then I added a
member variable of type enum to MyDisplay. So my class def now looks
like this:
class MyDisplay {
enum DisplayType {SMALL,MEDIUM,LARGE};
private:
DisplayType _displayType;
//....
// all the rest of the def is the same as before
}
I also added a default value in the constructor initialization list:
MyDisplay::MyDisplay() : _displayType(MEDIUM),
//rest of ctor def is same as before
Those are the ONLY two changes I've made so far. The app still
compiles without error. However, it now crashes when I run it. (If I
remove those changes, it will run perfectly). In particular, it
crashes when the vector of MyDisplay objects is being created. The
code creates 10 of them in total, and it crashes after the fourth one
has been constructed and added to the vector.
However, there does not seem to be a memory overload. The app never
uses more 3.5 MG memory, and each MyDisplay adds less than
200K.
PLEASE NOTE: I know that I'm leaving many possibly relevant details
out of my description, but it would be too much to ask anyone to look
at the whole app, as its fairly large. I'm just hoping that the
description above might ring some bells for someone.
Thanks for any thoughts,
cpp