Entering and exiting mesh edit mode uses a LOT of undo memory. #30730

Closed
opened 2012-03-30 07:33:17 +02:00 by Nathan Vegdahl · 17 comments
Member

%%%Using SVN revision 45277, compiled on xubuntu 12.04 beta, 64-bit

Entering and exiting edit mode on meshes appears to leak ram. This is not obvious on low-resolution or medium-resolution meshes, or during modeling without mode-switching, but it becomes a serious problem when working with very large meshes and doing frequent mode switching.

To reproduce, start Blender and subdivide the default cube a lot. Then repeatedly enter/exit edit mode, and watch the RAM usage grow.

Alternatively (the way I discovered it), you can open the dragon rig file from the Sintel production files, and enter/exit edit mode repeatedly on the dragon model. RAM usage sky-rockets.%%%

%%%Using SVN revision 45277, compiled on xubuntu 12.04 beta, 64-bit Entering and exiting edit mode on meshes appears to leak ram. This is not obvious on low-resolution or medium-resolution meshes, or during modeling without mode-switching, but it becomes a serious problem when working with very large meshes and doing frequent mode switching. To reproduce, start Blender and subdivide the default cube a lot. Then repeatedly enter/exit edit mode, and watch the RAM usage grow. Alternatively (the way I discovered it), you can open the dragon rig file from the Sintel production files, and enter/exit edit mode repeatedly on the dragon model. RAM usage sky-rockets.%%%
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'

%%%Looked into this,
This isnt a bug, but agree its really-bad, mesh editmode stored an undo state when entering, so as long as you toggle editmode it keeps storing copys of the mesh.

Editmesh should really be improved to use some binary diffing.

leaving open... :|%%%

%%%Looked into this, This isnt a bug, but agree its _really-bad_, mesh editmode stored an undo state when entering, so as long as you toggle editmode it keeps storing copys of the mesh. Editmesh should really be improved to use some binary diffing. leaving open... :|%%%

%%%Well, it's bad but it's just how current undo stack works -- it keeps fixed amount of undo steps in stack, not checks for memory usage or so. In fact, it's not only toggling edit mode which leads to enourmous memory usage, it's also any global undo stack which will eat your memory fast.
Wouldn't actually consider this is a bug, just good motivation to redesign undo system. Added extra item there http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/UserInterface#Undo_stack%%%

%%%Well, it's bad but it's just how current undo stack works -- it keeps fixed amount of undo steps in stack, not checks for memory usage or so. In fact, it's not only toggling edit mode which leads to enourmous memory usage, it's also any global undo stack which will eat your memory fast. Wouldn't actually consider this is a bug, just good motivation to redesign undo system. Added extra item there http://wiki.blender.org/index.php/Dev:2.5/Source/Development/Todo/UserInterface#Undo_stack%%%
Author
Member

%%%Ah, okay.

When I was working on the Sintel Dragon in 2.62, though, this didn't seem to be nearly as much of an issue. Recent SVN nearly freezes my computer after a few edit toggles, but 2.62 just breezes along fine.

Is this simply a difference in how much space the mesh representations take up? The reason I submitted it as a bug in the first place is because it seemed like a regression from 2.62 (e.g. I was forced to go back to 2.62 to get work done because of this).%%%

%%%Ah, okay. When I was working on the Sintel Dragon in 2.62, though, this didn't seem to be nearly as much of an issue. Recent SVN nearly freezes my computer after a few edit toggles, but 2.62 just breezes along fine. Is this simply a difference in how much space the mesh representations take up? The reason I submitted it as a bug in the first place is because it seemed like a regression from 2.62 (e.g. I was forced to go back to 2.62 to get work done because of this).%%%
Author
Member

%%%Hmm, also, doing some further testing, it seems like the memory limit on undo is miscalibrated. When I set it to 512MB, Blender's ram usage still increases by over 1GB due to the edit mode toggling.%%%

%%%Hmm, also, doing some further testing, it seems like the memory limit on undo is miscalibrated. When I set it to 512MB, Blender's ram usage still increases by over 1GB due to the edit mode toggling.%%%

%%%Hm, if it takes much more space in memory than in 2.62 release, probably it's something due to bmesh structures.Probably it stores mloops and tessfaces as well which isn't actually neededand which might cause 2x extra memory usage.
Would be interesting to investigate. Will assign to Campbell for now to check if memory usage might be optimized without requiring all that "packed" mesh storages.%%%

%%%Hm, if it takes much more space in memory than in 2.62 release, probably it's something due to bmesh structures.Probably it stores mloops and tessfaces as well which isn't actually neededand which might cause 2x extra memory usage. Would be interesting to investigate. Will assign to Campbell for now to check if memory usage might be optimized without requiring all that "packed" mesh storages.%%%

%%%Sergey, I dont think its todo with the BMesh structure (would only account for 5-10%),
I think its because BMesh undo steps store ALL shape keys.

... this is why some diffing is needed IMHO.
%%%

%%%Sergey, I dont think its todo with the BMesh structure (would only account for 5-10%), I think its because BMesh undo steps store ALL shape keys. ... this is why some diffing is needed IMHO. %%%

%%%Aah, indeed now shapekeys are in CD layers and this is indeed might be improved in quite simple ways i think. The only question would be is if we're going to make such changes before release?%%%

%%%Aah, indeed now shapekeys are in CD layers and this is indeed might be improved in quite simple ways i think. The only question would be is if we're going to make such changes before release?%%%

%%%I know that this might be quite off-topic, but could we have something similar for shapekeys as well? I mean that shapekeys only store and apply changes that have been made. Currently every shapekey is a full copy of the mesh. With larger meshes and a good dozen of shapekeys (alone for facial animation) it is really memory and computing intensive. The last time i tried to use corrective shapekeys on a mesh with roughly 5.000 polygons i had to give up this idea, because i had 40 shapekeys already and it was so slow that i could not really edit anymore.%%%

%%%I know that this might be quite off-topic, but could we have something similar for shapekeys as well? I mean that shapekeys only store and apply changes that have been made. Currently every shapekey is a full copy of the mesh. With larger meshes and a good dozen of shapekeys (alone for facial animation) it is really memory and computing intensive. The last time i tried to use corrective shapekeys on a mesh with roughly 5.000 polygons i had to give up this idea, because i had 40 shapekeys already and it was so slow that i could not really edit anymore.%%%

%%%imo Undo should ideally only store Stuff if changed and if possible only the part that changed (this might be a slow operation as well?). Just an Idea. %%%

%%%imo Undo should ideally only store Stuff if changed and if possible only the part that changed (this might be a slow operation as well?). Just an Idea. %%%

%%%Possibly reassign to Nicholas Bishop? http://wiki.blender.org/index.php/User:Nicholasbishop/BMeshUndo%%%

%%%Possibly reassign to Nicholas Bishop? http://wiki.blender.org/index.php/User:Nicholasbishop/BMeshUndo%%%
Member

%%%Global Undo does a binary diff on data chunks. If editmode in-out would leave the data unchanged, no undo memory would be needed. I guess BMesh stores a lot of pointers though, and these get re-generated on each TAB-TAB?

If shapekeys now store so much data by default; it would be worth checking on a way to re-use old shapes on exiting editmode...%%%

%%%Global Undo does a binary diff on data chunks. If editmode in-out would leave the data unchanged, no undo memory would be needed. I guess BMesh stores a lot of pointers though, and these get re-generated on each TAB-TAB? If shapekeys now store so much data by default; it would be worth checking on a way to re-use old shapes on exiting editmode...%%%

%%%bmesh undo is infact storing Mesh meshes (DNA data), just with no binary diffing.%%%

%%%bmesh undo is infact storing `Mesh` meshes (DNA data), just with no binary diffing.%%%
Member

%%%Closing, marked as todo. More efficient undo usage is a great project to work on :)%%%

%%%Closing, marked as todo. More efficient undo usage is a great project to work on :)%%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

Changed status from 'Archived' to: 'Resolved'

Changed status from 'Archived' to: 'Resolved'

Resolved 91bfdacde2

Resolved 91bfdacde2
Sign in to join this conversation.
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
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#30730
No description provided.