Improve memory management for external sorts.
Improve memory management for external sorts.

Introduce a new memory context which stores tuple data, and reset it
at the end of each merge pass; this helps avoid memory fragmentation
and, consequently, overallocation.  Also, for the final merge patch,
eliminate memory context chunk header overhead entirely by allocating
all of the memory used for buffering tuples during the merge in a
single chunk.  Since this modestly increases the number of tuples we
can store, grow the memtuples array a bit so that we're less likely to
run short of slots there.

Peter Geoghegan.  Review and testing of patches in this series by
Jeff Janes, Greg Stark, Mithun Cy, and me.

jmcatamney/gpdb,xinzweb/gpdb,jmcatamney/gpdb,lisakowen/gpdb,50wu/gpdb,ashwinstar/gpdb,adam8157/gpdb,50wu/gpdb,greenplum-db/gpdb,50wu/gpdb,adam8157/gpdb,jmcatamney/gpdb,lisakowen/gpdb,lisakowen/gpdb,xinzweb/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,50wu/gpdb,adam8157/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,50wu/gpdb,greenplum-db/gpdb,xinzweb/gpdb,adam8157/gpdb,greenplum-db/gpdb,lisakowen/gpdb,jmcatamney/gpdb,adam8157/gpdb,xinzweb/gpdb,ashwinstar/gpdb,adam8157/gpdb,lisakowen/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,lisakowen/gpdb,adam8157/gpdb,adam8157/gpdb,50wu/gpdb,lisakowen/gpdb,jmcatamney/gpdb,xinzweb/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,jmcatamney/gpdb,lisakowen/gpdb,jmcatamney/gpdb,xinzweb/gpdb,50wu/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,xinzweb/gpdb,50wu/gpdb,xinzweb/gpdb