There is one PDB stream for each module (compiland). This stream contains (among other things) all of the symbols for each compiland. Generally speaking this is where a large portion of memory associated with the PDB lies.
This patch slightly improves the VarStreamArray class by templatizing it on a value type and changing the length conversion function to a value / length extraction function. In doing so, we can now apply the VarStreamArray to symbol streams and iterate them exactly the same as before, but without copying the entire symbol stream into a contiguous buffer.
Measurements:
PDB File Size: 6,598,656 bytes
Combined size of all symbol streams: 1,985,508 bytes
So this is a savings of 30% of the PDB size. We should be able to claim another 30% or so by applying this to the type info streams.
Do you need a separate traits class? Looks like you can merge it into the non-traits class if you change the definition of VarStreamArray.