Page MenuHome

memory usage is higher after rendering with cycles
Closed, ResolvedPublic

Description

System Information
Windows 7 x64

Blender Version
Broken: 2.79 testbuild 2

Short description of error
After rendering a scene with cycles and a lot of textures, memory usage is higher than before rendering. If the file is saved after rendering, Blender will take as much memory on opening the file than after rendering (in attached file, 2.2GB of memory for a cube vs 109MB before rendering.

Exact steps for others to reproduce the error
in the default scene, switch to cycles and append the cube from this file:

.
It uses 109MB memory. Hit F12, now it uses 2.2GB.
It looks like the persistent data option has been activated and the textures are cached, also the option is deactivated.

Event Timeline

This .blend file is using generated images as textures. When Cycles renders generated / packed images, Blender will create / load the image buffers and keep them around in memory. For regular images on disk this is not a problem.

ok, then it's not a bug, but wouldn't it make sens to only have this behavior when "persistent data" is checked and free it otherwise?

another thing is, when I render on 2 GPUs a scene that takes more than dedicated memory, the system memory will be used. If those generated textures are kept around, we have 3 times the textures. The cache Blender silently creates and the 2 versions created by the OpenCL driver. As the time needed to initialize rendering is not much faster the second time compared to using the cache, but many GB memory are away, making it more certain that swapping will be triggered, the cache may greatly slow down render for a benefit which is pretty low, at least in my tests.

Edit: so to sum it up, I would better see persistent data patch https://developer.blender.org/D2613 from @Lukas Stockner (lukasstockner97) committed and have the cache only when user request so. It would respect Blender's philosophy of not thinking for the user.

Fixed now. D2613 only affects Cycles side persistent data, so would not have made any difference here.