I am a java programmer trying to understand a c++ oddity that I ran into. My c++ program writes a few MB of data using ofstream. Just before the program ends I close the ofstream. However when the program terminates, the amount of free memory on my linux box has decreased by the size of the data that was written. The memory remains lost until the file is deleted. Here is a sample of how I use ofstream:
In my constructor, I have:
ofstream tfile("../../tmp/outputfile.txt", std::ios::app);
a number of prints using tfile occur that are similar to the following line:
tfile << track->GetTrackID() << '\t' << track->GetParentID() << '\t' << pName << '\t';
In the destructor, I have:
Any ideas would be appreciated!