[Bf-committers] Memory bug

raulf at info.upr.edu.cu raulf at info.upr.edu.cu
Thu Feb 10 22:04:35 CET 2011

Hi Bretch :)

 Thanks a lot! this certainly explain everything ;)
 I need to store several different values, I need a float[3] for
accumulating neighbours positions, an int to store neighbours amount and
more advanced relaxation algorithm may need to store aditional
information like face area, angles , springs and stuff like that so as a
solution I will create a new structure with those fields and use the
(void *)tmp.p to store and retrieve them all.


> Hi,
> On Thu, Feb 10, 2011 at 5:40 PM,  <raulf at info.upr.edu.cu> wrote:
>> float *vert= (float *)MEM_callocN(3*me->totverts*sizeof(float ),
>> "vertsmooth");
>>        eve= em->verts.first;
>>        int counter = 0;
>>        while(eve) {
>>                if(eve->f & SELECT) {
>>                        (eve->tmp).p = &vert[counter];
>>                        (eve->tmp).fp = 0.f;
> Don't set fp to 0.f, since tmp is a union this also affects p. You can
> one of the two, but not both at the same time.
> Brecht.
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers

More information about the Bf-committers mailing list