Memory leak with GPU subdivision on rendering #100969
Closed
opened 2022-09-10 15:01:20 +02:00 by Philipp Weißenbach
·
24 comments
No Branch/Tag Specified
blender-v3.6-release
main
blender-v4.0-release
universal-scene-description
temp-sculpt-dyntopo
temp-sculpt-brush-channel
blender-v3.3-release
asset-browser-frontend-split
brush-assets-project
asset-shelf
anim/armature-drawing-refactor-3
temp-sculpt-dyntopo-hive-alloc
tmp-usd-python-mtl
tmp-usd-3.6
blender-v3.5-release
blender-projects-basics
blender-v2.93-release
temp-sculpt-attr-api
realtime-clock
sculpt-dev
gpencil-next
bevelv2
microfacet_hair
xr-dev
principled-v2
v3.6.4
v3.6.3
v3.3.11
v3.6.2
v3.3.10
v3.6.1
v3.3.9
v3.6.0
v3.3.8
v3.3.7
v2.93.18
v3.5.1
v3.3.6
v2.93.17
v3.5.0
v2.93.16
v3.3.5
v3.3.4
v2.93.15
v2.93.14
v3.3.3
v2.93.13
v2.93.12
v3.4.1
v3.3.2
v3.4.0
v3.3.1
v2.93.11
v3.3.0
v3.2.2
v2.93.10
v3.2.1
v3.2.0
v2.83.20
v2.93.9
v3.1.2
v3.1.1
v3.1.0
v2.83.19
v2.93.8
v3.0.1
v2.93.7
v3.0.0
v2.93.6
v2.93.5
v2.83.18
v2.93.4
v2.93.3
v2.83.17
v2.93.2
v2.93.1
v2.83.16
v2.93.0
v2.83.15
v2.83.14
v2.83.13
v2.92.0
v2.83.12
v2.91.2
v2.83.10
v2.91.0
v2.83.9
v2.83.8
v2.83.7
v2.90.1
v2.83.6.1
v2.83.6
v2.90.0
v2.83.5
v2.83.4
v2.83.3
v2.83.2
v2.83.1
v2.83
v2.82a
v2.82
v2.81a
v2.81
v2.80
v2.80-rc3
v2.80-rc2
v2.80-rc1
v2.79b
v2.79a
v2.79
v2.79-rc2
v2.79-rc1
v2.78c
v2.78b
v2.78a
v2.78
v2.78-rc2
v2.78-rc1
v2.77a
v2.77
v2.77-rc2
v2.77-rc1
v2.76b
v2.76a
v2.76
v2.76-rc3
v2.76-rc2
v2.76-rc1
v2.75a
v2.75
v2.75-rc2
v2.75-rc1
v2.74
v2.74-rc4
v2.74-rc3
v2.74-rc2
v2.74-rc1
v2.73a
v2.73
v2.73-rc1
v2.72b
2.72b
v2.72a
v2.72
v2.72-rc1
v2.71
v2.71-rc2
v2.71-rc1
v2.70a
v2.70
v2.70-rc2
v2.70-rc
v2.69
v2.68a
v2.68
v2.67b
v2.67a
v2.67
v2.66a
v2.66
v2.65a
v2.65
v2.64a
v2.64
v2.63a
v2.63
v2.61
v2.60a
v2.60
v2.59
v2.58a
v2.58
v2.57b
v2.57a
v2.57
v2.56a
v2.56
v2.55
v2.54
v2.53
v2.52
v2.51
v2.50
v2.49b
v2.49a
v2.49
v2.48a
v2.48
v2.47
v2.46
v2.45
v2.44
v2.43
v2.42a
v2.42
v2.41
v2.40
v2.37a
v2.37
v2.36
v2.35a
v2.35
v2.34
v2.33a
v2.33
v2.32
v2.31a
v2.31
v2.30
v2.28c
v2.28a
v2.28
v2.27
v2.26
v2.25
Labels
Clear labels
This issue affects/is about backward or forward compatibility
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
Apply labels
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
This issue affects/is about backward or forward 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
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
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
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 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
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
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Set Project
Clear projects
No project
Assignees
Assign users
Clear assignees
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#100969
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
System Information
Operating system: Linux-5.15.0-47-lowlatency-x86_64-with-glibc2.35 64 Bits
Graphics card: NVIDIA GeForce GTX 980/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 470.141.03
Blender Version
Broken: version: 3.4.0 Alpha, branch: master, commit date: 2022-09-09 22:58, hash:
352d55b1c8
and older versions after 3.02Worked: (3.01 and older)
Short description of error
While rendering an animation on a blender version newer than 3.0.1, GPU Subdivision causes
blender to leak the memory and crashes while rendering significantly slower.
I found this out after stripping down my project to this test file and removed almost everything unrelevant.
SHRINKWRAP_CRASH.blend
The shrinkwrap-modifier of the "Dress"-object, targeting the animated "Body"-object seems to cause the error.
The shrinkwrap-type doesn
t seem to make any difference. It seems to happen only on animated targets -like this*"Body"*-object. However, the other shrinkwrap-modifier on the*"Belt"*-object doesn
t cause any problem......Here are some Compairison, rendering up to frame 100 between:
blender 3.01...
{F13476736, size=full}
... and 3.30 LTS
(Rendertimes on top of the images)
{F13476738, size=full}
On my computer, it crashed after overflowing both virtual (swap) and physical memory (around frame200).
Exact steps for others to reproduce the error
*1 .Open the file. It shoud look like this..

*2. Select Menu Render-Render Animation (Ctrl-F12)
*3. Open you taskmanager and watch the memory usage. Let it render for some time. The memory shoud go linear up, until it crashes.
*4. (after crash..) Re-open blender and the file.
*5. Select the "Dress"-named object in the outline tab.

*6. Disable shrinkwrap-modifier on realtime and rendering.
{F13476692, size=full}
*7.Repeat steps 2 and 3

Now it shoud work.
Note. if you don`t do step.4 and re-open Blender, there is a change that the memory is not cleared up. However, it shoud not go lineary up like the first time.
*8. Try the same with the "Belt"-named Object. It shoud not make any differences..
Thats It. I hope, this was helpfull.
Happy Bugfixing;)
Added subscriber: @cpt_weissnerd
Added subscriber: @OmarEmaraDev
Changed status from 'Needs Triage' to: 'Needs User Info'
I can't reproduce the memory leak myself after rendering 100 frames, also can't detect the leak through memory tracing.
If I understand correctly, this only happens when rendering, not playing the animation or doing anything else.
Does this happen for EEVEE only or also Cycles?
Yes. It only happens during the rendering process. Not during the preview.
It primary happens on EEVEE, and as I found out on WORKBENCH to. (the Rendering-Resolution doesn
t make a difference) On Cycles, however, it doesn
t seem to happen as far as i coud test (The Memory doesn`t seem to go up).Again. It happens on every Blenderversion that I`ve tested, newer than 3.01 - Including the 3.4.0-alpha that i have downloaded a few minutes ago;)
Note: I only have 16GB RAM. Depending on you Memory-Size, you may not notice the Memory-increase during the first 100 frames.
During my tests. The memory increases linear about 7.6GB after rendering 100 frames on both EEVEE and WORKBENCH.
Hope this helps.
I can't replicate on either EEVEE or Workbench.
Could it be that your
/tmp
directory is mounted on RAM? Does changing the output directory resolve the issue?No. It doesn`t.
I changed everyting in the "File Pahts" to a path on my harddisk. It changes nothing.
Screenshot at frame 201 right before the crash :

I also tested everything on a different Machine with Windows10 -also with 16GB RAM- .

I downloaded the latest build of Blender 3.4.0-alpha from there and loaded the file.
The results where the same as on my ubuntu (Memory goes linear up during the rendering):
During this evening, i managed to create a more simple testfile just using the default objects after testing and trying a lot.
It produces exactly the same issue, but even more efficient.
NewVersion.blend
Just open the file and select "Render Animation"
On blender 3.01, i can render allday.

On blender 3.41Alpha and 3.30LTS. It crashes around frame 15
And if you brake up the rendering -like I did here on frame 13- the memory stays high and doesn`t go back immediately.
at least on my 16GB RAM- Machine...
If you don`t see anithing on you one, try to increase carefully the first Subsurf-modifier on the Suzanne-Object.
{F13489233 size=full}
Again, Good luck.
I hope this helps.
I feel like this might be due to GPU Subdivision, which I don't have enabled. Can you try if the issue still happens with
Preferences > Viewport > Subdivision > GPU Subdivision
disabled?!!!JACKPOT!!!!!!
If i turn GPU Subdivision off (it was on on default), blender 3.4.0 renders just normal and doesn`t overflow the memory.

Thanks so far:)
Changed status from 'Needs User Info' to: 'Needs Triage'
Good to hear. My GPU doesn't support GPU Subdivision, that's why I couldn't reproduce, so I will leave this to someone with the needed hardware.
shrinkwrap overflows memory while rendering and crashes.to Memory leak with GPU subdivision on renderingAdded subscribers: @kevindietrich, @mano-wii
Changed status from 'Needs Triage' to: 'Confirmed'
I can confirm the constant increase in memory (resembling a leak) and consequent crash.
In fact it seems to be related to the GPU subdivision (although without this option there is also a very slight progressive consumption of memory).
Here is a table with a sample of the allocations between two moments:

Cc @kevindietrich
Added subscriber: @Jacob9
shrinkwrap_memory_leak.blend
I just encountered this bug as well. Here is a minimal blend file which reproduces the leak (with GPU subdivision enabled).
However I have found a strange workaround, the bug only occurs when the target object has the subdivision modifier in the last slot. If there is another active modifier after the subdivision, the bug does not occur. In the attached blend file I have put an array modifier in the last slot of the object that is the target of the shrinkwrap and I have left it disabled, but if you enable it and render animation, the bug disappears.
Added subscriber: @Jeroen-Bakker
@Jacob9 that is expeceted. GPU subdivision only kicks in when the subdivision modifier is the last modifier.
I will check with ASAN if I can find anything.
Unassigning for now as my linux system needs to be reinstalled.
@Jeroen-Bakker, I quickly investigated, the leak is because we garbage collect the subdivision caches, but the caches are only freed at the end of the animation render (via
DRW_cache_free_old_subdiv()
). We would need to free the caches at the end of each frame, but I am not really sure where would the best place for that be.@kevindietrich thanks for looking into this. In the viewport this is done just after drawing a single view.
For viewport animation and final render we could do it at the time the results are downloaded.
This issue was referenced by
2eabe0a320
This issue was referenced by
88c956c13b
Changed status from 'Confirmed' to: 'Resolved'