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.
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.