Solved by albanD in post #2 
              
              
                Hi, 
Does adding a gc.collect() twice just after the del model helps? Looks like you’re making a circular reference of python object.