Do not a priori allocate memory for objects that will later be re-sized.
Here, this is the case for a CopyData object to be used in WorkStream: We have
to give WorkStrean::run() an exemplar of these CopyData objects from which
it will create a concrete object for each task (=cell or face) that will
then be worked on. We initialize the exemplar's '.data' object to a concrete
size, but this size will later be ignored and instead we resize things
to whatever we actually need in one place because we don't really know
what the correct size is going to be a priori. As a consequence, just omit
the original sizing and leave the 'exemplar.data' object empty until the
point where we know the size for a concrete object that we obtain by
copying the examplar.
As a side note: This is in DataOutFaces. The DataOut class doesn't do the
initial sizing -- I suspect that we had that code at some point in the past
and got rid of the initial sizing a few years ago but didn't make the same
change for DataOutFaces. It is also possible that that change was made
as part of the simplex transition in DataOut, but DataOutFaces was never
actually transitioned and doesn't work for simplices right now. (That's
what I'm working on right now, of course.)
In the beginning the Universe was created. This has made a lot of
people very angry and has been widely regarded as a bad move.
Douglas Adams