Why does my minecraft keep saying minecraft has run out of memory like every 3min in to playing?

This had never happened to me but it recently started to say that like every 2-3 minutes of playing the game what can i do to fix it… Has anyone had this problem before if so please tell me how you fixed it thanks

You can try changing some of the settings to make it use less memory and run faster. You should try…
Changing render distance to tiny
Turning your graphics on "fast" instead of "fancy"
Putting performance on "Max FPS"
Turning clouds and particles off
If none of these work you should try updating your graphics card. (I can't tell you how to do this unless I know your system specs) I hope this helped!

Get more ram

just get a better pc lol