Avoid heap reallocation each time a metarecord is written in memory (based on a patch by Warren Baird).