HDFS-5642: replace use of variable-length array with heap allocation.