Memory leak with exceptions raised from scripts in the text editor #112399

Closed
opened 2023-09-15 02:58:28 +02:00 by Campbell Barton · 0 comments

Impacts v3.6, main (4.0).

The steps to reproduce this bug are as follows:

  • Run blender --factory-startup -d (for leak reporting).
  • (Optional) subdivide the default cube, make the leak visible from system tools.
  • Open a text editor and paste the script (below).
  • Run the script (the error is expected), each execution will use more memory.
  • Exit Blender, notice the leak message. e.g.
Error: Not freed memory blocks: 180, total unfreed memory 585.008698 MB                                                                                                           
C_BVHTree_FromObject len: 1179672 0x7f1f55a91838                                                                                                                                  
C_BVHTree_FromObject len: 2359296 0x7f1f5024b838                                                                                                                                  
BVHTree len: 48 0x60b00035a3e8                                                                                                                                                    
BVHNodes len: 2097184 0x7f1f50048838                                                                                                                                              
BVHNodeBV len: 6291552 0x7f1f4f1d2838                                                                                                                                             
BVHNodeBV len: 8388736 0x7f1f4367a838                                                                                                                                             
BVHNodeArray len: 8388736 0x7f1f365b2838                                                                                                                                          
C_BVHTree_FromObject len: 786432 0x7f1f559ce838                                                                                                                                   
C_BVHTree_FromObject len: 1179648 0x7f1f53b22838                                                                                                                                  
C_BVHTree_FromObject len: 1179672 0x7f1f43557838                                                                                                                                  
C_BVHTree_FromObject len: 2359296 0x7f1f3ebdf838   

Script:

import bpy
from mathutils.bvhtree import BVHTree

ob = bpy.context.active_object

depsgraph = bpy.context.evaluated_depsgraph_get()

bvh_leak = BVHTree.FromObject(ob, depsgraph)

__raise_an_error__
Impacts v3.6, `main` (4.0). The steps to reproduce this bug are as follows: - Run `blender --factory-startup -d` (for leak reporting). - (Optional) subdivide the default cube, make the leak visible from system tools. - Open a text editor and paste the script (below). - Run the script (the error is expected), each execution will use more memory. - Exit Blender, notice the leak message. e.g. ``` Error: Not freed memory blocks: 180, total unfreed memory 585.008698 MB C_BVHTree_FromObject len: 1179672 0x7f1f55a91838 C_BVHTree_FromObject len: 2359296 0x7f1f5024b838 BVHTree len: 48 0x60b00035a3e8 BVHNodes len: 2097184 0x7f1f50048838 BVHNodeBV len: 6291552 0x7f1f4f1d2838 BVHNodeBV len: 8388736 0x7f1f4367a838 BVHNodeArray len: 8388736 0x7f1f365b2838 C_BVHTree_FromObject len: 786432 0x7f1f559ce838 C_BVHTree_FromObject len: 1179648 0x7f1f53b22838 C_BVHTree_FromObject len: 1179672 0x7f1f43557838 C_BVHTree_FromObject len: 2359296 0x7f1f3ebdf838 ``` Script: ``` import bpy from mathutils.bvhtree import BVHTree ob = bpy.context.active_object depsgraph = bpy.context.evaluated_depsgraph_get() bvh_leak = BVHTree.FromObject(ob, depsgraph) __raise_an_error__ ```
Campbell Barton added the
Severity
Normal
Type
Report
Status
Needs Triage
labels 2023-09-15 02:58:29 +02:00
Blender Bot added
Status
Resolved
and removed
Status
Needs Triage
labels 2023-09-15 04:25:48 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
1 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#112399
No description provided.