BGE bullet physics constraint memory leak #38448

Closed
opened 2014-02-02 17:05:12 +01:00 by Jean-Francois Gallant · 22 comments

System Information
Windows 7 64bit with Geforce 8800 GTX

Blender Version
Broken: Blender Windows 64bit 2.69.0 r60995

Short description of error
When "bge.constraints.createConstraint" is used and many constraint is created and deleted , memory raise very fast.
I run some simulation need to do this many time over the night. At beginning memory taken by blender is like 100mo ... but
after 8hours , memory taken by Blender is near to 5-6Gigs. If no constraint created, memory stay near to the same ( around 100mo ).
See the attached blend file

Exact steps for others to reproduce the error

  • Open the attached .blend file
  • Press P to run game engine to see what exactly happening
  • Look how memory raise ( task manager of windows )
  • Press Esc so end the game engine
  • In the script editor , at line 4 , change the code "timerEnd = 300" for "timerEnd = 3"
  • Press P to run game engine again
  • Look how memory raise ( task manager of windows )
**System Information** Windows 7 64bit with Geforce 8800 GTX **Blender Version** Broken: Blender Windows 64bit 2.69.0 r60995 **Short description of error** When "bge.constraints.createConstraint" is used and many constraint is created and deleted , memory raise very fast. I run some simulation need to do this many time over the night. At beginning memory taken by blender is like 100mo ... but after 8hours , memory taken by Blender is near to 5-6Gigs. If no constraint created, memory stay near to the same ( around 100mo ). See the attached blend file **Exact steps for others to reproduce the error** - Open the attached .blend file - Press P to run game engine to see what exactly happening - Look how memory raise ( task manager of windows ) - Press Esc so end the game engine - In the script editor , at line 4 , change the code "timerEnd = 300" for "timerEnd = 3" - Press P to run game engine again - Look how memory raise ( task manager of windows )

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @pyroevil

Added subscriber: @pyroevil
[bge_memoryleak.blend](https://archive.blender.org/developer/F75804/bge_memoryleak.blend)

Added subscriber: @Moguri

Added subscriber: @Moguri

Could you try a build from http://builder.blender.org/download/? I'm not seeing a memory leak (either via Valgrind or anything significant via a system monitor). I remember fixing some constraint memory issues a little while back.

Could you try a build from http://builder.blender.org/download/? I'm not seeing a memory leak (either via Valgrind or anything significant via a system monitor). I remember fixing some constraint memory issues a little while back.
HyperV commented 2014-02-10 11:22:00 +01:00 (Migrated from localhost:3001)

Added subscriber: @HyperV

Added subscriber: @HyperV
HyperV commented 2014-02-10 11:22:00 +01:00 (Migrated from localhost:3001)

The reason why it is causing a memory leak is because it doesn't process the loop.
If you set the timerEnd to 3 it creates an infinite loop.that is the reason why the memory is raising and it doesn't free the memory.

It needs more time to process the loop and should free the memory.

i have uploaded the same file with some features to see the the process.bge_memoryleak.blend.

HyperV

The reason why it is causing a memory leak is because it doesn't process the loop. If you set the timerEnd to 3 it creates an infinite loop.that is the reason why the memory is raising and it doesn't free the memory. It needs more time to process the loop and should free the memory. i have uploaded the same file with some features to see the the process.[bge_memoryleak.blend](https://archive.blender.org/developer/F76695/bge_memoryleak.blend). HyperV

moguri: I download the latest build and I try it.

HyperV: Not sure I understand. Blender need time in the loop to free memory? Put timerEnd to 3 is probably excessive but it's just to show faster how memory increase. At 300 it's work too but just take more time. timerEnd at 30 raise memory to approximatly 1Mo per 10sec. In my realcase scenario , I have many objects with many constraints , but remove it to every 300,500 or even 1000 tics , it's still increase. I lunch a sims during the weekend and when I coime back today I see memory going from 80Mo to 30Go. Here is what I simulate exactly: https://www.youtube.com/watch?v=mJaI2bnaq9Q

moguri: I download the latest build and I try it. HyperV: Not sure I understand. Blender need time in the loop to free memory? Put timerEnd to 3 is probably excessive but it's just to show faster how memory increase. At 300 it's work too but just take more time. timerEnd at 30 raise memory to approximatly 1Mo per 10sec. In my realcase scenario , I have many objects with many constraints , but remove it to every 300,500 or even 1000 tics , it's still increase. I lunch a sims during the weekend and when I coime back today I see memory going from 80Mo to 30Go. Here is what I simulate exactly: https://www.youtube.com/watch?v=mJaI2bnaq9Q

Not working with build with hash a84bcea 2014-02-09 17h03

One detail I ommit in th main description is: If I left the gaming running for a amount of time (starting to 80Mo of ram for example) , until reaching 2Go of ram ( or any other number , this don't matter ) for example and I press ESC to exit the "game" and come back to Blender , the memory stay high. Never come back to "normal". If I start the game engine engine again , it's just continue to increase. I already left it running until I go over the memory of my computer and starting to be really slow.

Adding a loop in the second loop to make it more slow not working too.

EDIT: If I remove the 3 lines where I add the constraint and remove it ( so , not create any constraint ) , the memory stay really stable. The problem seam really to be with the constraints.

Not working with build with hash a84bcea 2014-02-09 17h03 One detail I ommit in th main description is: If I left the gaming running for a amount of time (starting to 80Mo of ram for example) , until reaching 2Go of ram ( or any other number , this don't matter ) for example and I press ESC to exit the "game" and come back to Blender , the memory stay high. Never come back to "normal". If I start the game engine engine again , it's just continue to increase. I already left it running until I go over the memory of my computer and starting to be really slow. Adding a loop in the second loop to make it more slow not working too. EDIT: If I remove the 3 lines where I add the constraint and remove it ( so , not create any constraint ) , the memory stay really stable. The problem seam really to be with the constraints.
HyperV commented 2014-02-13 10:49:47 +01:00 (Migrated from localhost:3001)

i did some research about the memory leak i found that if you change the cnsType to 10 it stays stable and change it to 11 or 12 the memory is raising up and at 13 it stays stable.

HyperV

i did some research about the memory leak i found that if you change the cnsType to 10 it stays stable and change it to 11 or 12 the memory is raising up and at 13 it stays stable. HyperV

when cnsType 12 is changed for 10 , 11 or 13 , no constraints is created for the file bge_memoryleak.blend
If I try it on my quadruped or biped blend file project , Blender just close ( crash ).

from: http://www.tutorialsforblender3d.com/BGE_Python/Physics_Constraints/6DOF/6DOF_createConstraint.html

0 = No Constraint
1 = Point to Point Constraint
2 = Line Hinge Constraint
11 = Vehicle Constraint
12 = 6DOF Constraint (6 Degrees Of Freedom)

when cnsType 12 is changed for 10 , 11 or 13 , no constraints is created for the file bge_memoryleak.blend If I try it on my quadruped or biped blend file project , Blender just close ( crash ). from: http://www.tutorialsforblender3d.com/BGE_Python/Physics_Constraints/6DOF/6DOF_createConstraint.html 0 = No Constraint 1 = Point to Point Constraint 2 = Line Hinge Constraint 11 = Vehicle Constraint 12 = 6DOF Constraint (6 Degrees Of Freedom)
Member

Added subscriber: @brita

Added subscriber: @brita

Added subscriber: @JacobMerrill-1

Added subscriber: @JacobMerrill-1

cycling add rigid body joint remove rigid body used to crash randomly, but that was in a very complex file, I will try again on 2.74 in my more predictable newer game files.

cycling add rigid body joint remove rigid body used to crash randomly, but that was in a very complex file, I will try again on 2.74 in my more predictable newer game files.
Member

Added subscriber: @JorgeBernalMartinez

Added subscriber: @JorgeBernalMartinez
Member

I can not reproduce the memory leak (opensuse linux 64bits). @pyroevil could you check it again with current master as createConstraint has been improved during blender 2.73-2.74?

I can not reproduce the memory leak (opensuse linux 64bits). @pyroevil could you check it again with current master as createConstraint has been improved during blender 2.73-2.74?

memory still raising on my side with Blender version 2.74 Date: 2015-03-31 13:39 Windows 64bit

Put "timerEnd" variable at a value of 3 to see it increase faster ( in the internal python script named "script" )

memory still raising on my side with Blender version 2.74 Date: 2015-03-31 13:39 Windows 64bit Put "timerEnd" variable at a value of 3 to see it increase faster ( in the internal python script named "script" )

Added subscriber: @panzergame

Added subscriber: @panzergame

Confirm the memory leak (fedora linux 64).

Confirm the memory leak (fedora linux 64).

Added subscriber: @AlanT

Added subscriber: @AlanT

This issue was referenced by a790e172d0

This issue was referenced by a790e172d0281e64517ff44d80f1c0139c3ab665

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
8 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#38448
No description provided.