Root files, directories & objects - WinNT (pt 2)

From: Mariusz Stanczak (MStanczak@usa.net)
Date: Thu Dec 02 1999 - 11:08:49 MET


Hello,
   The version 2.23/09 has fixed the problem with the number of directories
on a root file, but still not all is well.  I write some objects (class
version of a structure with simple data types) in top level directories on a
root file.  The class is instantiated, written to a file, and deleted, BUT
it's memory is never dealocated.  Consequently the system memory is
exhausted resulting in a system hang.  I tried doing f.Flash(), f.Write()
with no change.  Only f.Close() works.
   I'm not sure it's a pertinent observation, but my code is the same, and
under the previous version of Root even though the memory was being used up
and accumulated just as it is now (despite the immediate deletes), it was
all being freed up at once as if there was a garbage collection done right
before the crash (caused by the large number of directories), now
(obviously) I do not observe such activity.
   There seems to be no mechanism to force root file (or Root) to flush it's
buffers (or is there?).  All the methods that I found to facilitate this
have been applied to TTrees and not to TFile, and that's all I have...
TFile, TDirectory, and a simple class object.  What to do?  Anything... it's
desperate time for this project and it's use of Root.

Thank you,
/Mariusz

P.S.  It's all under WinNT 4sp5 and VC++ 6sp1

---- the code ----
	while(fgets(l_in, 120, f_in)) {
		sscanf(l_in, "%s %s %f %f %f %f %d",
			t, d, &fo, &fh, &fl, &fc, &fv);

		if (strcmp(t, prev_t) != 0) {
			gDirectory->Write(NULL, TObject::kOverwrite);
			strcpy(prev_t, t);

			if (!syms->FindObject(t)) {
				f_out->cd();
				f_out->mkdir(t, " ");
			}
			f_out->cd(t);
		}
		D1 = new RPCls(d, fo, fh, fl, fc, fv);
		D1->Write();
		delete D1;
	}
	f_out->Write(NULL, TObject::kOverwrite);
---- end of code ----



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:43 MET