# Storing/Reading custom class

**URL:** <https://root-forum.cern.ch/t/storing-reading-custom-class/13663>\
**Category:** ROOT\
**Created:** [January 24, 2012, 2:34pm UTC](https://root-forum.cern.ch/t/storing-reading-custom-class/13663 "2012-01-24T14:34:28Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![bpnuke](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/d9b06d/32.png) [@bpnuke](https://root-forum.cern.ch/u/bpnuke)\
**Post date:** [January 13, 2020, 6:44pm UTC](https://root-forum.cern.ch/t/storing-reading-custom-class/13663/13 "2020-01-13T18:44:53Z")

</div>

The way we have it working right now is just to instantiate a TFile and write the TTree separate from the object. ROOT was crashing for me if I filled the TTree object from binary then ask it to write the TTree to a TFile using the TTree::Write() call. I believe the correct method of filling large (\>1Gb) TTrees is to instantiate a TFile then the TTree such that the TDirectory the TTree is linked to is a real file. As you fill the tree it writes to file such that you don’t end up trying to write a multi-Gb TTree to a file.

---

_[View the full topic](https://root-forum.cern.ch/t/storing-reading-custom-class/13663)._
