I would suggest you clear as many variables as you can during runtime, so you don't store a lot of information in them all the time. This consumes a lot of memory. Also, if you use Chrome in your flow, it might make sense to switch to Edge. Chrome is a monster when it comes to eating up memory.
If you have any less than 8GB of RAM, you should also get more installed, if possible. 8GB is the minimum. For a flow that should run infinitely, you would actually need more - I'm guessing at least 32GB.
And yet, you should still not expect it to run infinitely. It's not designed to be run this way, and it will consume loads and loads of resources. I assume the reason you are doing this is so that you don't need a paid Premium license, but really, at $15/month it's not really that expensive. I can't think of a process that wouldn't save you this much, but would still be worth automating.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.