Page MenuHome

Memory Leak in Collada Importer
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows 10

Blender Version
Broken:
2.81 (sub 16), branch: master, commit date: 2019-11-18 12:53, hash: 115a5bf65a6b, type: Release

Short:
The memory consumption increases constantly when Collada files are imported. Even when loading another Blender file, the used memory is not reduced.

Detailed:

  • Download the Blender and Collada file to the same directory
  • Check the memory usage of Blender (~90 MB in my case)
  • Open the Blender file and execute the simple script (Reproduction.py)
  • Check the memory usage of Blender (~ 350 MB in my case)
  • File -> New -> General
  • Check the memory usage of Blender (~ 350 MB in my case)

I discovered this issue when implementing a batch processing script where I was running out of memory to my surprise.


Event Timeline

Andy (DeepBlender) edited projects, added Collada; removed Add-ons.Nov 21 2019, 1:12 PM
Germano Cavalcante (mano-wii) lowered the priority of this task from 90 to High.

I confirm the memory leak.

Error: Not freed memory blocks: 3200, total unfreed memory 439.819336 MB

Mostly allocated in:

void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve)

@Gaia Clary (gaiaclary), would you mind taking a look at this?

hmm, that is odd. I see where it obvioulsy goes wrong. I wonder though. It looks like an old bug. just out of curiosity: Have you checked if the memory leak also happens when you try with an animation that only contains trans/rot/loc and not matrix curves? I suspect that with that there is no memory leak...

I will take care :)

I never had a look at the actual Collada files, but only tried to reproduce the issue. Would it help if I checked that?

There is no need to check it before the import is fixed. I was just curious to know in advance.

The thing is that the importer uses 16 fcurves to store matrix values whenever an animation is imported that has a stride of 16 in the animation Source (indicating matrix data) I believe those fcurves need to be removed later because they are just intermediate stores. However those curves are later marked as "used by blender" so that the importer does not remove them when cleaning up. And that most probably is the cause of the memory leak.

@Andy (DeepBlender) : The Collada memory leak is fixed. However when i run your test script again, then there is still another leak:

Error: Not freed memory blocks: 2, total unfreed memory 0.000198 MB
new gesture len: 88 000001A76B4379F8
gesture rect new len: 16 000001A76B47CC88

The reported blocks are probably created in:

wmGesture.c : wmGesture *WM_gesture_new(bContext *C, const wmEvent *event, int type)

@Campbell Barton (campbellbarton) : Can you give me a hint how i should proceed (if at all) ?

Gaia Clary (gaiaclary) changed the task status from Unknown Status to Resolved.Nov 26 2019, 11:24 AM

@Campbell Barton (campbellbarton) thanks for the fix!

So we can close this ticket now as fully resolved.