That’s strange, as I cannot see any obvious reason for the memory growth.
Also. I used your code with a fake dataset just to make sure I’m not overlooking something, and your code runs just fine. The memory stays at the same level through 1000 iterations.