I have a project on which I have to render thousands of different screenshots of a scene. It is basically a for loop that changes the scene, calculates some stuff and renders. However after around 2000 I blender complains that it is out of memory. In fact at each iteration it shows that the usage of memory is increasing, but I don't understand why, since I am not adding new elements to the scene and i am not keeping information from previous iterations.

enter image description here

I guess that there is some variable which is not being free in the loop. However I have no idea on how to find out that. Do someone have any ideas?


This is the error that I have: enter image description here

  • $\begingroup$ Very hard to say what's wrong without seeing the script you run. $\endgroup$ Apr 8, 2021 at 23:23
  • $\begingroup$ Hi, thanks, I just figured out the problem. I was generating a new texture at each iteration and they were being retained as data blocks by blender. So I add bpy.ops.outliner.orphans_purge() at the end of each iteration and it solved the problem. $\endgroup$
    – Manveru
    Apr 8, 2021 at 23:48

1 Answer 1


In case anyone have a similar problem, I figured out the solution. My script was generating a new texture at each iteration. I thought it was being discarded but actually not, blender was retaining this information as orphan data. So I simply needed to add bpy.ops.outliner.orphans_purge() at each iteration to clean this unused data that was loading my memory.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .