Scrpy starts to consume a lot of RAM when I play on my PC! (original) (raw)

When I'm playing something light and using discord, the program works normally, consuming around 96mb of RAM.
When I play something heavier, like Cs2 or Elden RING, consumption starts to increase uncontrollably until my PC uses maximum memory and closes everything (I have 32gb of RAM).
I wanted to know how to solve this or if anyone else has experienced this. My device is a Poco F3 and I use Windows 10 Pro.