Mail Archives: djgpp/1998/08/12/22:00:37
From: | Al Christians <achrist AT easystreet DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Template/STL questions
|
Date: | Wed, 12 Aug 1998 18:54:42 -0700
|
Organization: | Trillium Resources Corporation
|
Lines: | 45
|
Message-ID: | <35D24762.7E27@easystreet.com>
|
Reply-To: | achrist AT easystreet DOT com
|
NNTP-Posting-Host: | dial-35-088.easystreet.com
|
Mime-Version: | 1.0
|
NNTP-Posting-Date: | 13 Aug 1998 01:47:00 GMT
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I'm having trouble with a big program failing with little dignity and
a segment fault, and am fishing for any ideas about what might be
breaking it. TIA for any suspicions or likely suspects. The program
makes heavy use of the <string>, <map>, <vector>, and a few other
related headers.
One symptom that looks real baad is that when I do
string a;
I don't get an empty string, but
string a("");
in the same place does work ok. So it seems that something is perhaps
clobbering indiscriminately. This leads to suspicions about all the
templates getting used. Another thing we find is that
vector<string> b(100);
b.clear()
b[0] = "0";
will work ok, but
vector<string> b;
b.push_back(string("0"));
will fail, i.e. any attempt to access b after the push_back gives the
segment error. But doing it the other way
b[0] = string("0");
will also cause the failure right there.
There are plenty of STL collections allocated on the stack, and I
fear that the stack might be getting corrupted as these things are
supposed to be growing and shrinking automatically. Specifically,
we have some map<string, vector<string> > objects on the stack where
the vectors within the map are supposed to be growing and shrinking.
Changing the stack size between 500k and 4M doesn't seem to help at
all.
Al
- Raw text -