Page MenuHome

Memory (file-handles) leak using py script (Win7-64bit only)
Closed, ResolvedPublic

Description

Win-7 64 blender 2.6.0(a) r41226

When using a python script to render image or video (in loops)
the handles count and memory used by blender keep increasing permanently until blender is closed.

A very simple test script and scene like the one attached will do
Memory when we start see test1.png
After script run once some memory and handles are not returned to the system
So for 50 images rendered blander already consume +6K handles and +1MB (see test2.png)
After script run twice and 100 images blender consume +13K handles and +1.4MB (see test3.png)

In the screenshot the 2 over blender process are running from more than 12Hours and use more than 1M handles and +150MB (not talking about the 200MB that handles use as kernel unpaged memory)

Loading a new blend file is not releasing the memory nor handles .
When blender is closed or quit if started in batch (with -b test.blend -p test.py ) all that memory and handles are released.

These leak prevent to run safely very long batch script (over days and week) as it will end up consuming all the system memory.

Event Timeline

Tested on linux and WinXP - in both cases the file handles and memory dont go up significantly.

(Notifiers and wmEvents are added - which could be resovled when running from python) but nothing like the numbers you are talking about.

- Campbell

I'll give a try under under Xp and let you know
I have one bender process running from more than 24hr >6K images and it reacehd 2.2M handles
I also notice it does the same by using "render animation" wihotu any script

tested blender 2.62 r44136 64 bit on win7-64 same issue whenever rendering a frame handle increase
tested blender 2.62 r44136 32 bit on win7-64 do not show the isue the handles count remain very low (260)

Assigning to our windows maintainer.

If the windows version of python library fails to close file handles, shouldn't this be put in the python.org tracker?

@Ton, check the script 'test.py', python isnt doing any file operations, its just calling render.

Tested this now on Windows 7, can indeed see handles leaking in 2.62, 2.63 and 2.64 when pressing Animation render, without even using a script.

When I disable OpenColorIO in my build the leaks stop, however this feature was added only in 2.64 so I'm not sure what's going on.

I believe the issue was fixed in svn rev52485. Thanks for the report, closing.

P.S. If i'm wrong please describe steps how to make handles leak again and i'l lfix that as well! :)

Sergey Sharybin (sergey) changed the task status from Unknown Status to Resolved.Nov 22 2012, 1:55 PM