Can you send a recipe for reproducing the problem? I didn't have any trouble running diff 3.10 on a Fedora 40 machine with only 8 GiB RAM, in directories with 100,000 files. The following shell commands succeeded quietly:
mkdir d e (cd d && touch $(seq 100000)) (cd e && touch $(seq 100000)) diff -r d e