Significant decrease of palloc overhead by storing the values in-place.

For example to aggregate 40M unique 32-bit values, the previous implementation used ~3GB of RAM, while the new one uses just about 1GB.

Original implementation:

    AggContext: 3085618688 total in 4369 blocks; 550671240 free (2890675 chunks); 2534947448 used

New implementation:

    AggContext: 1047186944 total in 4126 blocks; 310154248 free (2890481 chunks); 737032696 used

So there's still a lot of room for improvement, but it's much better overall. It's also slightly faster (~10%).