Re: A malloc error in C++
Re: A malloc error in C++
- Subject: Re: A malloc error in C++
- From: Lyndsey Ferguson <email@hidden>
- Date: Wed, 29 Aug 2007 17:04:21 -0400
- Thread-topic: A malloc error in C++
On 8/29/07 4:44 PM, "Laurence Harris" <email@hidden> wrote:
> On Aug 29, 2007, at 4:34 PM, Giacomo Monari wrote:
>
>> Lyndsey Ferguson ha scritto:
>>> What is at line 183 in file "/Users/giacomomonari/Programmi
>>> C++/lab3_1/lab3_1.cpp"?
>>>
>>>
>> The instance of a vector I added later in the program that's for
>> future things... But the program changes in nothing before...
>
> Is there some reason you posted code containing a lot of distracting
> stuff you added after you first noticed the problem? That just makes
> it likely people are going to waste time diagnosing the wrong thing.
It looks like there are issues that you are going to have to work on one by
one.
1. Start out with the very basic functionality. Try filling in _just_ the
"z" vector<double> and analyzing that. Then move on to the next part.
2. Use Guard Malloc (Menu: Xcode->Debug->Enable Guard Malloc). Read the
Xcode documentation on malloc debugging (a previous poster mentioned
malloc_history on the PID when this happens -it helps).
3. You may want to take this to a c++ group:
http://groups.google.com/group/comp.lang.c++.moderated/topics
4. As an aside, you may also want to refactor the code a little. Reading it
is quite an eyeful. For instance, instead of seeing this line of code
everywhere:
GMNLFS::DataAnalysis<vector<double>::iterator,double> zAnalysis(z.begin,
z.end());
You could:
typedef GMNLFS::DataAnalysis<vector<double>::iterator,double>
DataAnalysisType;
And then use it:
DataAnalysisType zAnalysis(z.begin(), z.begin());
Even better if you could just:
DataAnalysisType zAnalysis(z);
And you may want to think about writing a function:
DisplayAnalysisResults(DataAnalysisType analysis), that prints out all the
items. Rather than copying and pasting each cout << '...'; Just some
thoughts to help you read the overall structure.
Good luck,
Lyndsey Ferguson
--
Mr. Lyndsey D. Ferguson
Software Engineer
Nemetschek N.A., Inc.
http://www.nemetschek.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden