-3

i am working on a project and in that project i am processing a lot of image in my program, and when i finish of an image i move to the next image, but the problem is that when i reach the 10th image, i see that the RAM is full of data, because the last images are still in the RAM.

some times i find that there is 2GB of the RAM is taken because of the images that i processed, but i do not need them anymore.

in this case how can i clear the RAM or Free it from Those image that i do not need anymore ?

Pythoner-sh
  • 134
  • 6
  • 1
    Python is a memory-managed language there is no way to explicitly free memory. Instead, you should make sure that you don't keep references around to objects you no longer need (this is usually easy if you make use of functions and don't just put everything into the global scope). Then, you just let Python's garbage collection take care of things. Without more details about what exactly you are doing, it is hard to give you more specific advice. – juanpa.arrivillaga Sep 01 '23 at 08:22

0 Answers0