title: Reinforcement Learning Program Freezes over time
body: <p>I am currently working on a Reinforcement learning program that teaches itself how to play the game snake. The Issue I am facing is that as the program runs in the background, it slowly eats up more and more of the memory and ultimately, the program crashes. I made sure to check if there is any lists that slowly grow over time. As far as I know, there is no such lists as they become empty at the beginning of every iteration. I have added the training code below(Images of the code):</p>
  
  <p><a href="https://i.stack.imgur.com/1oaOj.png" rel="nofollow noreferrer">Code part 1</a></p>
  
  <p><a href="https://i.stack.imgur.com/CfHzv.png" rel="nofollow noreferrer">Code part 2</a></p>
  
  <p><a href="https://i.stack.imgur.com/scW2I.png" rel="nofollow noreferrer">Code part3</a></p>
  
  <p>This is the first time I am posting a question in stackoverflow. Apologies if I have posted the question in a wrong manner.</p>