Currently it allocates memory to hold the headers and implicitly to manage a vector of item pointers. Having the writer class provide the storage for the headers (feasible, since the packet size is bounded) and recycling a vector for item pointers would eliminate the malloc/free overheads.