Page MenuHome

Bullet viewport integration allocates too much memory on Windows for several shape types
Closed, ArchivedPublic

Description

I noticed some strange behavior regarding Bullet integration in viewport, occurring only on Windows systems but with all builds including the official releases.

It's related to the shape type of the collision object and its memory consumption. Every shape type other than triangle mesh will result in a significantly higher memory footprint during simulation than usual on other platforms. Always 5 to 8 times more depending on shape type. Only in game engine everything is OK.

I did following comparisons, for each I started a fresh Blender instance and checked the process table of the task manager:

Test scene: 4096 cubes (16^3 array) = 24.576 quads

Bullet in game engine
- Shape: Triangle Mesh, 1.5 GB used
- Shape: Convex Hull, 1.0 GB used
- other Shapes: 0.5 GB used

Bullet in viewport
- Shape: Triangle Mesh, 1.3 GB used
- Shape: Convex Hull, 8.8 GB used
- other Shapes: 5-8 GB used

Apparently this doesn't seem to happen on Linux only Windows. Test scenes are attached.

Details

Type
Bug

Event Timeline

Scorpion81 provided a blend file that works even on Windows (memory usage below 0.5 GB for Convex Hull). I wasn't able to recreate this even after factory reset but I attached his blend here. He also reports that the faulty file attached even doesn't work on Linux right. Maybe this is a good starting point for investigation.

Blend was too large for tracker, I splitted it now.

hello,

i just opened these three files and took a look to the Windows 'TaskManager' on my windows PC, (opened one by one in a new blender instance)
... here the screenshots of TaskManager... the values of memory usage are very similar.
http://www.pasteall.org/pic/54703

... here my system details
http://www.pasteall.org/43698/text

Well, did you start the simulation? (Alt+A)

hit [Alt]+[A], should i ?!, ... sorry, for my lack of knowledge.
wow, what a difference ...
... here all three files during animation:
http://www.pasteall.org/pic/54715
the first two are very similar (blender render / blender game), maybe it is because of my internal intel HD4000 GPU on i7-3770 CPU.
i made the screenshot after few frames were updated 2-3 for the first two .blend files (0.00x fps).
the third was way faster and with less memory usage (1.x .. 3.x fps).

the memory usage for the first file jumps down from 8.x GB down to 2.x GB after frame ~20 (when the cube cluster hits the palne) and stays at this amount during re-playback the calculated animation.

oh, and the blender game file i started, i think that is what you wanted ... the memory usage is ~1.x GB
http://www.pasteall.org/pic/54718

PS.: the memory usage is not depending on the GPU, because i tested is on my clone system with an external AMD HD 5670 GPU... with very similar results.

i tested it on the same hardware with different OS (looks all exact the same on my system)

linux (ubuntu 13.04 64bit)
http://www.pasteall.org/43703/text
http://www.pasteall.org/pic/54723

Windows 8 64bit
http://www.pasteall.org/pic/54724

... but maybe i still make something wrong. :(

Scorpion81 reported that my file don't work on Linux either, so maybe there went already something wrong when I set it up (in Windows). He set up his own file on Linux which worked with around 1 GB (that's the attached "working" file) but I couldn't recreate it in Windows without recreating the problem that it takes up about 8 GB as well.

I don't think it's a hardware or driver problem whatsoever. There must be something different in that .blend file compared to the working one. The question is, what is it and where does the difference come from?

Ok, I've looked into this for a bit now.

The problem is object scaling. If you apply scale of the cubes in the attached file memory use is back to normal.

Since the problem doesn't exist in the game engine I assume that it's a bug in bullet's scaling feature, that the game engine doesn't use. That also explains why it doesn't happen with mesh shapes.
I'll see what I can do about it.

@Julian Eisel (Severin), actually I wanted to look into this again soon, maybe in the next few weeks when I can find some time.
Unfortunately it's not so simple to track down.

Sure, just wanted to blow some fresh air into this ;)

@Sergej Reich (sergof), did you find time to look into? otherwise i'll move it to physics memory optimization TODO.