I'm a little unclear on who owns the mark objects. You have the discriminator
stack of marks, and also infoset nodes with referenced counters to marks. The
discriminator stack of marks is used to determine when to call the walk() as
well as to keep track of discrimination, and the infoset nodes
I've added a new proposal to allow Daffodil to use a more stream-like
behavior when creating infoset events, and to remove infoset nodes when
possible to reduce memory usage. The proposal is available here:
https://cwiki.apache.org/confluence/display/DAFFODIL/Proposal%3A+Infoset+Streaming+and+Memo