Memory leak and design violation in curve evaluation #96498
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
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#96498
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: Linux-5.16.0-4-amd64-x86_64-with-glibc2.33 64 Bits
Graphics card: Quadro RTX 6000/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 510.54
Blender Version
Broken: version: 3.2.0 Alpha, branch: Unknown, commit date: Unknown Unknown, hash:
rBUnknown
Worked: Prior to D11597
c946fdb2e5
Short description of error
Rendering on playing back
lib/tests/render/motion_blur/multi_step_motion_blur.blend
results in memory leak.Exact steps for others to reproduce the error
Easiest to see if LSAN is enabled, but guarded allocator also catches the issue.
Way 1: Open the file, hit F12, observe memory leak printed on exit.
Way 2: Open the file, hit playback, exit
There are two things which on a glance seems to be wrong in the new implementation (since the mentioned patch) in the
BKE_displist_make_curveTypes
.The
ob->data
at the moment of the function is called is not "localized" to the object: if multiple objects are sharing the same curve multiple copy-on-write objects will share the same copy-on-write curve. This means that writing tocow_curve.curve_eval
is "illegal". The general rule: do not write to object-data level when evaluating object. This general rule is violated without either explanation or realization that it is something bad.The freeing of
Curve::curve_eval
is only happening in thecurve_free_data
, which means evaluating same depsgraph at different times will not free this data:cow_curve.curve_eval = nullptr;
.P.S. The comment in the
Curve::CurveEval
statesOwned by the object's #geometry_set_eval
. That's the giveaway: something owned by object level can not be stored in the object-data level.Added subscriber: @Sergey
Changed status from 'Needs Triage' to: 'Confirmed'
Yikes, I just realized the problem is worse than I expected. Even in 3.1, a modifier on a single curve object affects all users of the original curve. I'm amazed that behavior made it so long in master.
{F12929626 size=full}
I can relatively easily fix that problem by moving the final evaluated
CurveEval
around to a different place, but not yet without causing other problems. Maybe I'll have better luck tomorrow.Really though, I'm thinking that the easiest/best way to fix this might be just using the new curves object for rendering. That's already planned for the next week or two anyway.
Will this allow us to get rid of
CurveEval
from theCurve
datablock?Other thought to keep in mind: is this issue something we want to be fixed in possible upcoming corrective release for 3.1?
Other than that, focusing on the proper solution is surely better idea than trying to find a quicker and less ideal fix.
Yes, it would, since
Curve
wouldn't be used for rendering at all. We would just need a way to draw theCurve
edit mode overlays from theCurves
data type, which sounds a bit weird, but maybe still better than alternatives.Hmm, I don't really think so, it's a bad bug but also a tenuous situation, not an area I'd change in a corrective release.
This issue was referenced by
a7c65ef4cb
Changed status from 'Confirmed' to: 'Resolved'