Update: 2019 iMac 5K supports up to 128GB.
Usually 64GB memory is enough, and in the 2017 iMac 5K, 64GB is the limit.
Working in the field recently, the 2017 iMac 5K was running slowly. Investigating, it was clear that there was not enough memory—the system had begun to use memory compression and swap file space.
Shown below is memory usage on Photoshop assembly a 237 megapixel stitched panorama composed of ten 45-megapixel 16-bit images from the Nikon D850. The system was forced into compressed memory mode with associated swap file on disk. Performance thus drops. The problem pops up when doing series of 187-megapixel 16-bit Multi-Shot High-Res mode images, which before any operations, each take nearly gigabyte each.
Maybe the next iMac can have more memory slots? Probably not, and unfortunately that means a lot more cost to get to 128GB—more expensive memory modules.