Photoshop will use all the RAM you allow it to. Mine's set to 96% (of 48GB). I've seen it use 44GB.
It creates scratch files and moves old history data out before the crunch hits, while you're working so that if you do run short of RAM it will already have more that it can immediately use. It's very sophisticated. They left simplistic implementation behind about 2 decades ago.
-Noel