← Back to team overview

yade-dev team mailing list archive

Re: [Branch ~yade-dev/yade/trunk] Rev 2344: - miniEigen : memory leak source suspected (FIXME added)

 

Bruno Chareyre said:     (by the date of Mon, 12 Jul 2010 11:40:12 +0200)

> 
> >    - CohFrictLaw : Eigen is returning nan quaternions after trivial operations, it is workarounded in the law.
> >    
> Raising attention on this fix, as other functors could have the same 
> problem.
> 
> Take quaternions q1init,q1, q2init,q2, with q1 (resp. q2) close to 
> q1init (resp. q2init). In that case, 
> AngleAxisr(q1*q1init.conjugate*q2init*q2.conjugate) will sometimes 
> return nan rotation while it should be null.
> 
> The fix in cohesiveFrictionalContactLaw.cpp:133 is :
> if (isnan(aa.angle())) aa.angle()=0;

OMG, guys. we need to either modify eigen, or write a wrapper for
quaternions. It is not possible to put such stupid lines everywhere
in the code. Same goes about quaternions losing their norm()==1.0
 
> Bruno
> 
> p.s. This is the sort a jokes I was expecting from eigen move, when I 
> was asking for strong testing... It took me 2 hours to find the 
> problem.  Who knows if there are other surprises left?
> 
> p.s.2 : There is I think a potential memory leak with functions below, 
> are they used?
 
> +//FIXME : risk of memory leak with these "new"?
>   static Quaternionr* Quaternionr_fromAxisAngle(const Vector3r&  axis, const Real angle){ return new Quaternionr(AngleAxisr(angle,axis)); }
>   static Quaternionr* Quaternionr_fromAngleAxis(const Real angle, const Vector3r&  axis){ return new Quaternionr(AngleAxisr(angle,axis)); }

use bzr blame to find who wrote this. This code is crazy wrong.

-- 
Janek Kozicki                               http://janek.kozicki.pl/  |



Follow ups

References