btDbvtBroadpase::destroyProxy very slow

Phillemann
Posts: 9
Joined: Tue Feb 03, 2009 6:36 pm

btDbvtBroadpase::destroyProxy very slow

Post by Phillemann »

I'm using a btDbvtBroadphase with a lot of objects (~10000). I use it in its "raw" form, meaning it's not connected to a world. I only use it to frustum cull boxes.
Everything works fine, except at the end of the program. There, for every object in the broadphase, destroyProxy is called. This takes about 20 seconds on my machine (!). Leaving out the destroyProxy for the objects solves the problem, but then I have a memory leak. And also, I don't think that's a "clean" solution.
So what should I do?
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: btDbvtBroadpase::destroyProxy very slow

Post by Dirk Gregorius »

Are you profiling a debug- or release build?
Phillemann
Posts: 9
Joined: Tue Feb 03, 2009 6:36 pm

Re: btDbvtBroadpase::destroyProxy very slow

Post by Phillemann »

It's slow in the release build, too, I've tried it.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: btDbvtBroadpase::destroyProxy very slow

Post by Dirk Gregorius »

how slow?
Phillemann
Posts: 9
Joined: Tue Feb 03, 2009 6:36 pm

Re: btDbvtBroadpase::destroyProxy very slow

Post by Phillemann »

As I said in the first post, cleaning up 10000 proxies takes about 20 seconds. It's also perfectly clear why: Instead of just "purging" the whole tree at once, each node is removed from the tree separately. Yet I don't see any way around that other than free()ing the proxy myself.
Dirk Gregorius
Posts: 861
Joined: Sun Jul 03, 2005 4:06 pm
Location: Kirkland, WA

Re: btDbvtBroadpase::destroyProxy very slow

Post by Dirk Gregorius »

20 seconds really sounds weird. Anyway, you can write a purge method yourself. You have the source.