← Back to team overview

yade-dev team mailing list archive

Re: [yade/trunk] 59b663: Give the newly created body an id, which is the si...

 

>> Sure of that?
>> The size of the container will increase forever, no?

> I think, it is correct. This lowestFree variable can have only an
> advantage, when you delete the last created body. It is a specific
> case and I do not think it happens often. It causes also LP:1001194,
> which is critical.

Still the container will increase forever (memory leak).
I would think lowestFree is always usefull unless you delete the last
created body.
I you remove body 7/N, then the new one will have id 7 whatever N,
without changing the size of the container. It happens almost always if
N is high.

Alternatively, we could just remove "doInitSort=true" form the "if
dirty" block.
It seems harmless after a quick look, but I'm not sure of that.

Last note, I see this in ISCollider.cpp:

// bodies deleted; clear the container completely, and do as if all
bodies were added (rather slow…)
// future possibility: insertion sort with such operator that deleted
bodies would all go to the end, then just trim bounds
if(2*nBodies<BBsize){ for(int i=0; i<3; i++) BB[i].vec.clear(); }
// more than 100 bodies was added, do initial sort again
// maybe: should rather depend on ratio of added bodies to those already
present...?
if(2*nBodies-BBsize>200 || BBsize==0) doInitSort=true;

It means deleting bodies without immediatly creating new ones OR adding
more than 100 bodies at once is slow, just like in initial Anton's fix.
I think we can improve that in current collider implementation.

Bruno


References