Noticeably higher RAM consumption with packed textures #97510
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#97510
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
System Information
Operating system: Has been reported on Mac and Linux, has been observed under Windows as well
Graphics card:
Blender Version
3.1.2 but has been reported as early as January 28
Short description of error
For context, I am reporting on behalf of the SheepIt Renderfarm team.
Our users and we noticed a significant increase in RAM consumption and IO when using packed textures as compared to externally linked textures.
In a test a with a 3 GB Blend file 151GB were read from disk.
The report in January was about a project that could be rendered on a 16 GB Mac with linked textures but would use up to 60 GB when packed.
I will include their final verdict:
We cannot provide you with any of these files so I tried to recreate it. In my tests relative.blend peaked at 850 MB while packed.blend used 1380 MB. I understand that in this case the difference could just be the extraction of the the textures into RAM so I am not really satisfied with this example. I will try to provide a better one if need be.
Exact steps for others to reproduce the error
relative.blend
Pack Resources
packed.blend
file to skip a few steps)or
bug report.zip
Added subscriber: @randomGuyOnTheInternet
Added subscriber: @Raimund58
Added subscriber: @mano-wii
Changed status from 'Needs Triage' to: 'Needs Developer To Reproduce'
I can confirm the extra RAM consumption even though the images are not actually being used in Blender.
Memory is allocated in
BKE_packedfile_new
.And right after it is written in the Blender file in
BKE_packedfile_blend_write
.If data is written to the .blend file, and the packed image is not being used, should it really consume RAM?
If this is a bug or intentional, I imagine it's up to the #core team to inform us.
Thanks for taking a look. I should have specified that I mean RAM consumption during rendering specifically, not during the packing
Added subscriber: @mont29
Extra RAM consumption with packed files is expected, by definition you put the external file's content inside your current Blend file. We could maybe theoretically try to 'clear' the embedded file once the Blend has been written on disk, and have a mechanism to reload it when required, but that would likely be complex to get working properly, since it would be violating quiet a few rules/principles in current data-blocks and blend file handling.
But issue here is related to rendering, and I think this is because CoW copies of IDs (from depsgraph evaluation) currently blindly also duplicate the packed files data! This is obviously wrong, will prepare a patch for this.
Added subscriber: @Sergey
hrrrmmm, investigating the code further, images are actually NOT duplicated in depsgraph... Nor during rendering it seems.
So besides the first point in my first comment ("Extra RAM consumption with packed files is expected").
Regarding rendering, when using Cycles there is an optimization for external files, which get directly read by Cycles into its own image buffers, completely by-passing Blender's Image ID /ImBuff system. So if you do not load the image in Blender itself (by e,g displaying it in the Image editor or the 3DView). This is not possible currently for packed Images, which need to be first read by Blender into its own cache (ImBuff buffers system), and then stored again by Cycles into its own data structure, resulting in the image being three times in memory (one as packed data, one as Blender cache, one as Cycles image). Thanks @Sergey for helping understanding what's going on here.
While this is not optimal, there is no bug here. Thanks for the report.
For the record, here are my measurements with provided test file:
Changed status from 'Needs Developer To Reproduce' to: 'Archived'
With the actual design, if this is not a bug, then I guess it means that packing is intended for assets distribution, not for production. Once we get a packed asset in a project, we have to unpack it for production.