Re: A malloc error in C++
Re: A malloc error in C++
- Subject: Re: A malloc error in C++
- From: "Clark Cox" <email@hidden>
- Date: Wed, 29 Aug 2007 07:54:43 -0700
On 8/29/07, Giacomo Monari <email@hidden> wrote:
>
> Hello everyone,
> while running a program called lab3_1 written in c++ I get this in the Run
> Log:
>
> lab3_1(1517) malloc: *** error for object 0x1804400: incorrect checksum for
> freed object - object was probably modified after being freed, break at
> szone_error to debug
> lab3_1(1517) malloc: *** set a breakpoint in szone_error to debug
>
> lab3_1 has exited due to signal 11 (SIGSEGV).
>
> and the debugger window pops up...
> Note that this happens after the program has done its work...
>
> What could it be? How could I resolve it?
>
> I also include the main of my program; it basically analyzes certain data
> from a file called "3cr_1.txt"...
>
> #include <iostream>
> #include <string>
> #include <fstream>
> #include <vector>
> #include "dataAnalysis.h"
>
>
> using namespace std;
>
> namespace
> GMNLFS=Giacomo_Monari_Numerical_Library_For_Simulations;
>
> int main (int argc, char * const argv[]) {
>
> ifstream dataFile("/Users/giacomomonari/Programmi
> C++/lab3_1/3cr_1.txt");
> if (dataFile.fail())
> {
> cout << "No data file!" << endl;
> }
>
> string dummy1;
> getline(dataFile,dummy1);
> dummy1.~string();
Here's your problem. Why are you trying to call the destructor directly?
...
> zAnalysis.~DataAnalysis();
and again here.
...
> mvAnalysis.~DataAnalysis();
and again here.
...
> s178Analysis.~DataAnalysis();
and yet again
...
> a150Analysis.~DataAnalysis();
ditto
...
> lasAnalysis.~DataAnalysis();
...
> llsAnalysis.~DataAnalysis();
...
> loglbAnalysis.~DataAnalysis();
...
> logp178Analysis.~DataAnalysis();
etc.
--
Clark S. Cox III
email@hidden
_______________________________________________
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