Multiple memory leak defects #120767
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
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#120767
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?
Dear Blender developers,
I have identified a memory leak defect in the latest version of Blender. The detailed path of the defect is as follows:
1.In the file /blender/extern/mantaflow/helper/util/simpleimage.cpp, a pointer variable named "pic" is defined on line 155, and a dynamic memory region is allocated using the new operator. If the if statement on line 159 returns true, the program returns on line 162 without executing the release operation on the dynamic memory region pointed to by "pic" on line 203. This constitutes a memory leak defect, as illustrated in the diagram below:
https://github.com/LuMingYinDetect/blender_defects/blob/main/blender_4.png
Hi, thanks for finding the memory leak. But could you mention all of these in single report. I think creating new report for each case will just increase the noise 😅
I apologize for any inconvenience caused! I have uploaded the HTML file containing all memory leak defects from the report for your reference!
Hello, in addition to the memory leak defect discovered earlier, I have found a new memory leak defect. Here are the details:
There is a memory leak defect at line 352 in the file /blender/source/blender/blentranslation/msgfmt/msgfmt.cc.
At line 292 of the file, a pointer variable named 'msgs_memarena' is defined, and a dynamic memory area is allocated through the function 'BLI_memarena_new'. When the 'if' statement at line 350 returns true, the program will return at line 352 without executing the release operation on the dynamic memory area pointed to by 'msgs_memarena' at line 438, thereby causing a memory leak defect, as shown in the attached image.
There is a memory leak defect on line 162 of the file /blender/extern/mantaflow/helper/util/simpleimage.cpp.to Multiple memory leak defectsDetails of another newly discovered defect:
There is a memory leak defect at line 564 in the file /blender/source/blender/editors/object/object_bake.cc.
1.At line 559 of /blender/source/blender/editors/object/object_bake.cc, a pointer named 'bkr' is defined, and a dynamic memory area is allocated using the 'MEM_cnew' operator. When the 'if' statement at line 562 returns true, the program will return at line 564. During this process, the dynamic memory area pointed to by 'bkr' is neither used for data at line 574 nor released, as shown in the attached image.
Maybe we can use unique_ptr in this case. I don't build with bake options (building is super slow on my laptop) so can't really check this :/
I think this is valid case. Memory only freed at the end of make() so returning early would indeed cause the leak.
I'm not sure about the other cases mentioned in html file (hard to read them atm).
Don't know where exactly the leak is happening in
uiTemplateMarker
fromclip_buttons.cc
. Can you explain?Re: leak in
sequencer_preview.cc
, we could move the allocation ofaudiojob
after if/else conditionCan confirm the possible leak in
alloc_proxy_output_ffmpeg
fromindexer.cc
. Need to free memory when condition ofBLI_file_ensure_parent_dir_exists
is true.Can confirm in
simpleimage.cpp
but not sure about theCache.cpp
Marking this as confirmed since most of the cases are straightforward to check.
Anyways, @ChengduLittleA already created PR for this !120766
Regarding the memory leak present in the clip_buttons.cc file, you can refer to the description below.
1.In the file /blender/source/blender/editors/space_clip/clip_buttons.cc, a pointer variable named "cb" is defined on line 408, and a dynamic memory region is allocated using MEM_cnew. If the if statement on line 417 returns false, the program executes the else branch on line 444. If the if statement on line 449 returns true, the program returns on line 465. During this process, the dynamic memory region pointed to by "cb" is not deallocated, constituting a memory leak defect, as illustrated in the diagram below:
https://github.com/LuMingYinDetect/blender_defects/blob/main/blender_3.png
Yes thanks, can confirm the leak when track is locked.
I think we can close this one now?
@ChengduLittleA Not yet. Items 3, 4, 7, and 8 from https://github.com/LuMingYinDetect/blender_defects/tree/main are still pending.
@deadpin I'll take care of those.
Issue 4 is external (mantaflow), and the thing in issue 7 is that the program will terminate anyway so not much need to manually free those since there are a lot of early return paths.
Yeah, 7 would be low prio since that's really just a build-time tool. It's not included in our releases and, as you say, the process is on its way to exiting anyhow.
4 is effectively us. Upstream is no longer updating and we will forever remain on whatever is in
extern
so I'd say we can do the small fix for it. I'm not sure what would trigger that code path for us to be fair though.@deadpin I see. I'll make the mantaflow fix :D
Thanks @ChengduLittleA for handling rest cases :)