Error in TFile->AutoSave();

Hello Rooters

I have a error-crash during a TFile->AutoSave();

my C++ code;

TFile* fTheTreeFile = new TFile(“file.root”, “recreate”);
TTree* = new TTree(“AutoTree”, “Automatic filled Tree”);

// i define branches ( near 5000 leafs of one short )

// in a loop a fill the tree
…fTheTree-> Fill()

// and each 30 seconds a do a save
fTheTreeFile-> cd();

I run the code in valgrind an a error appears more an more often during fTheTree->AutoSave();
==18992== Warning: set address range perms: large range [0x4d1d6028, 0x5317d3ba) (undefined)
==18992== Warning: set address range perms: large range [0x4d1d6018, 0x5317d3ca) (noaccess)

and after few minutes a crach allways in fTheTree->AutoSave();

18992 new/new[] failed and should throw an exception, but Valgrind
cannot throw exceptions and so is aborting instead. Sorry.
==18992== at 0x4025871: VALGRIND_PRINTF_BACKTRACE (valgrind.h:3695)
==18992== by 0x4027199: operator new[](unsigned int) (vg_replace_malloc.c:268)
==18992== by 0x415EECD: TBuffer::TBuffer(TBuffer::EMode, int) (in /home/global/root/root5.26_00fc11/lib/
==18992== by 0x4DC758B: TBufferFile::TBufferFile(TBuffer::EMode, int) (in /home/global/root/root5.26_00fc11/lib/
==18992== by 0x4DF7548: TKey::TKey(TObject const*, char const*, int, TDirectory*) (in /home/global/root/root5.26_00fc11/lib/
==18992== by 0x4DDE5B8: TFile::CreateKey(TDirectory*, TObject const*, char const*, int) (in /home/global/root/root5.26_00fc11/lib/
==18992== by 0x4DD3E7F: TDirectoryFile::WriteTObject(TObject const*, char const*, char const*, int) (in /home/global/root/root5.26_00fc11/lib/
==18992== by 0x589EEA7: TTree::AutoSave(char const*) (in /home/global/root/root5.26_00fc11/lib/
==18992== by 0x808A2EC: GAcq::FillTree(void*) (GAcq.C:399)
==18992== by 0x808A5CD: GAcq::DoRun(unsigned int) (GAcq.C:1074)
==18992== by 0x8126002: G__GRUDict_968_0_35(G__value*, char const*, G__param*, int) (GRUDict.C:15271)
==18992== by 0x47F70A6: Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) (in /home/global/root/root5.26_00fc11/lib/
==18992== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 108 from 2)
==18992== malloc/free: in use at exit: 816,847,327 bytes in 360,818 blocks.
==18992== malloc/free: 973,346 allocs, 612,527 frees, 6,260,173,225 bytes allocated.
==18992== For counts of detected errors, rerun with: -v
==18992== searching for pointers to 360,818 not-freed blocks.
==18992== checked 801,492,728 bytes.
==18992== LEAK SUMMARY:
==18992== definitely lost: 1,271,744 bytes in 46,347 blocks.
==18992== possibly lost: 3,911,002 bytes in 114,595 blocks.
==18992== still reachable: 811,664,581 bytes in 199,876 blocks.
==18992== suppressed: 0 bytes in 0 blocks.
==18992== Rerun with --leak-check=full to see details of leaked memory.

Is it a problem of resources? ( the process reached 1.7 Gbytes)

thanks for your help


[quote]Is it a problem of resources? ( the process reached 1.7 Gbytes)[/quote]Yes, the process is running out of memory.

6,260,173,225 bytes allocated.Seems like a somewhat large number …


The solution for me was to add a fTheTree->FlushBaskets();
juste before fTheTree->AutoSave();

Thanks for you help