BufferPool problem

Discuss any questions about BEPUphysics or problems encountered.
wanghongliang
Posts: 18
Joined: Sun May 05, 2019 2:01 pm

Re: BufferPool problem

Post by wanghongliang »

Hi,Norbo,thanks for your patience. My app needs to remove/add tons of physical entities(more than 20,000) frequently. When a thread dispatcher is used, the app sometimes endlessly freezes, sometimes crashes due to AccessViolationException. When the thread dispatcher is removed, everything works fine, and to my surprise, the app actually runs faster! So my question is why thread dispatcher is not stable enough and slowing things down?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: BufferPool problem

Post by Norbo »

Are you using multiple threads to add to/remove from the simulation simultaneously, or while the simulation is running? Both will definitely corrupt the simulation and things will fail in arbitrarily bad ways.

If it's not that, the fact that you're seeing access violations means something has gone terribly wrong. Race conditions, buffer overruns, memory corruption, or NaNsplosions are likely.
wanghongliang
Posts: 18
Joined: Sun May 05, 2019 2:01 pm

Re: BufferPool problem

Post by wanghongliang »

No, I am using the main thread to add to/remove from the simulation. My terrain is huge(512km x 512km) and composed of
1 million patches, and I want to move reusable trees (the total number of trees is more than 40,000,000) and their physical entities( each tree represented as a bunch of convexhulls) from patch to patch. When game scene jumps from one
patch to another, the problem occurs. Maybe I should be responsible for a little bit of abusing Bepu. :lol:
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: BufferPool problem

Post by Norbo »

Unfortunately, I don't have enough information to suggest anything in particular. It definitely shouldn't be throwing access violations :P

If you can reproduce it in the demos, I could take a closer look. Grabbing the source and running in debug mode could help too- there are a lot of asserts that would probably catch whatever is going wrong before an access violation (if it's related to engine state).
Post Reply