All of this can add up to quite a few megabytes. This includes every file and its history, plus whatever else Photoshop needs to keep things running. If you’re working with large files or photos, your computer has to store a lot of data in RAM.
“Turn it off and back on” is the most common tech support tip for a reason: it often works, and Photoshop is no exception.