Fix extreme memory usage with min/max macros. This should land in 6.6.17.