I tend to agree with Doc Brown's answer: you'll better use a database. That might be sqlite or a real database server: mongodb or postgresql, etc.... You could perhaps use an indexed file like GDBM (instead of a database) in some limited circumstances. If the data is small (which apparently it is not) you might consider persisting all of it in some textual formats like JSON (which you could also use inside database tables).
You should also define if your data structure is a real tree (without shared sub-nodes) or if it is a graph. You may have to manage the set of already dumped items, and handle shared data. Shared pointers and smart pointers may matter a lot.
You could store, in every significant object in memory, some database identifier (or id number), and perhaps other meta-information related to saving the data (saving timestamp, change time, etc...)
BTW, copying Garbage Collection algorithms may be relevant (since persisting to some database is quite similar to a copying GC). Read also the GC handbook.
You might be interested by persistence and application checkpointing.
You should design the persistence machinery quite early if possible.