Revision: 43696
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43696
Author:   campbellbarton
Date:     2012-01-25 20:18:12 +0000 (Wed, 25 Jan 2012)
Log Message:
-----------
remove cellalloc, from my tests jemalloc beats cellalloc, so we better just use 
a better malloc replacement.

See Details:

http://wiki.blender.org/index.php/User:Ideasman42/BMeshBranchReview#Update_43694

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c
    branches/bmesh/blender/source/blender/blenkernel/intern/deform.c
    branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c
    branches/bmesh/blender/source/blender/blenkernel/intern/multires.c
    branches/bmesh/blender/source/blender/blenkernel/intern/particle.c
    branches/bmesh/blender/source/blender/blenkernel/intern/particle_system.c
    branches/bmesh/blender/source/blender/blenlib/CMakeLists.txt
    branches/bmesh/blender/source/blender/blenloader/intern/readfile.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_interp.c
    branches/bmesh/blender/source/blender/bmesh/intern/bmesh_mesh.c
    branches/bmesh/blender/source/blender/editors/object/object_vgroup.c
    branches/bmesh/blender/source/blender/editors/sculpt_paint/paint_vertex.c
    branches/bmesh/blender/source/blender/windowmanager/intern/wm_init_exit.c

Removed Paths:
-------------
    branches/bmesh/blender/source/blender/blenlib/BLI_cellalloc.h
    branches/bmesh/blender/source/blender/blenlib/intern/BLI_cellalloc.c

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c        
2012-01-25 20:12:37 UTC (rev 43695)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/customdata.c        
2012-01-25 20:18:12 UTC (rev 43696)
@@ -49,7 +49,6 @@
 #include "BLI_linklist.h"
 #include "BLI_math.h"
 #include "BLI_mempool.h"
-#include "BLI_cellalloc.h"
 #include "BLI_utildefines.h"
 
 #include "BKE_customdata.h"
@@ -139,7 +138,7 @@
                MDeformVert *dvert = (MDeformVert *)((char *)dest + i * size);
 
                if(dvert->totweight) {
-                       MDeformWeight *dw = 
BLI_cellalloc_calloc(dvert->totweight * sizeof(*dw),
+                       MDeformWeight *dw = MEM_callocN(dvert->totweight * 
sizeof(*dw),
                                                                                
        "layerCopy_mdeformvert dw");
 
                        memcpy(dw, dvert->dw, dvert->totweight * sizeof(*dw));
@@ -158,7 +157,7 @@
                MDeformVert *dvert = (MDeformVert *)((char *)data + i * size);
 
                if(dvert->dw) {
-                       BLI_cellalloc_free(dvert->dw);
+                       MEM_freeN(dvert->dw);
                        dvert->dw = NULL;
                        dvert->totweight = 0;
                }
@@ -167,7 +166,7 @@
 
 static void linklist_free_simple(void *link)
 {
-       BLI_cellalloc_free(link);
+       MEM_freeN(link);
 }
 
 static void layerInterp_mdeformvert(void **sources, float *weights,
@@ -200,7 +199,7 @@
 
                        /* if this def_nr is not in the list, add it */
                        if(!node) {
-                               MDeformWeight *tmp_dw = 
BLI_cellalloc_calloc(sizeof(*tmp_dw),
+                               MDeformWeight *tmp_dw = 
MEM_callocN(sizeof(*tmp_dw),
                                                                                
        "layerInterp_mdeformvert tmp_dw");
                                tmp_dw->def_nr = dw->def_nr;
                                tmp_dw->weight = dw->weight * interp_weight;
@@ -211,10 +210,10 @@
        }
 
        /* now we know how many unique deform weights there are, so realloc */
-       if(dvert->dw) BLI_cellalloc_free(dvert->dw);
+       if(dvert->dw) MEM_freeN(dvert->dw);
 
        if(totweight) {
-               dvert->dw = BLI_cellalloc_calloc(sizeof(*dvert->dw) * totweight,
+               dvert->dw = MEM_callocN(sizeof(*dvert->dw) * totweight,
                                                                
"layerInterp_mdeformvert dvert->dw");
                dvert->totweight = totweight;
 
@@ -430,18 +429,18 @@
                        /* happens when face changed vertex count in edit mode
                           if it happened, just forgot displacement */
 
-                       BLI_cellalloc_free(s->disps);
+                       MEM_freeN(s->disps);
                        s->totdisp= (s->totdisp/corners)*nverts;
-                       s->disps= 
BLI_cellalloc_calloc(s->totdisp*sizeof(float)*3, "mdisp swap");
+                       s->disps= MEM_callocN(s->totdisp*sizeof(float)*3, 
"mdisp swap");
                        return;
                }
 
-               d= BLI_cellalloc_calloc(sizeof(float) * 3 * s->totdisp, "mdisps 
swap");
+               d= MEM_callocN(sizeof(float) * 3 * s->totdisp, "mdisps swap");
 
                for(S = 0; S < corners; S++)
                        memcpy(d + cornersize*S, s->disps + cornersize*ci[S], 
cornersize*3*sizeof(float));
                
-               BLI_cellalloc_free(s->disps);
+               MEM_freeN(s->disps);
                s->disps= d;
        }
 }
@@ -458,7 +457,7 @@
        }
 
        if (!d->disps && d->totdisp)
-               d->disps = BLI_cellalloc_calloc(sizeof(float)*3*d->totdisp, 
"blank mdisps in layerInterp_mdisps");
+               d->disps = MEM_callocN(sizeof(float)*3*d->totdisp, "blank 
mdisps in layerInterp_mdisps");
 }
 
 #else // BMESH_TODO
@@ -585,7 +584,7 @@
 
        for(i = 0; i < count; ++i) {
                if(s[i].disps) {
-                       d[i].disps = BLI_cellalloc_dupalloc(s[i].disps);
+                       d[i].disps = MEM_dupallocN(s[i].disps);
                        d[i].totdisp = s[i].totdisp;
                }
                else {
@@ -609,7 +608,7 @@
                if(corners != sub_elements) {
                        MEM_freeN(disps->disps);
                        disps->totdisp = disps->totdisp / corners * 
sub_elements;
-                       disps->disps = 
BLI_cellalloc_calloc(3*disps->totdisp*sizeof(float), "layerValidate_mdisps");
+                       disps->disps = 
MEM_callocN(3*disps->totdisp*sizeof(float), "layerValidate_mdisps");
                }
        }
 #endif
@@ -622,7 +621,7 @@
 
        for(i = 0; i < count; ++i) {
                if(d[i].disps)
-                       BLI_cellalloc_free(d[i].disps);
+                       MEM_freeN(d[i].disps);
                d[i].disps = NULL;
                d[i].totdisp = 0;
        }
@@ -635,7 +634,7 @@
 
        for(i = 0; i < count; ++i) {
                if(!d[i].disps)
-                       d[i].disps = 
BLI_cellalloc_calloc(sizeof(float)*3*d[i].totdisp, "mdisps read");
+                       d[i].disps = MEM_callocN(sizeof(float)*3*d[i].totdisp, 
"mdisps read");
 
                if(!cdf_read_data(cdf, d[i].totdisp*3*sizeof(float), 
d[i].disps)) {
                        printf("failed to read multires displacement %d/%d 
%d\n", i, count, d[i].totdisp);

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/deform.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/deform.c    
2012-01-25 20:12:37 UTC (rev 43695)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/deform.c    
2012-01-25 20:18:12 UTC (rev 43696)
@@ -45,9 +45,6 @@
 #include "BLI_utildefines.h"
 
 
-#include "BLI_cellalloc.h"
-
-
 void defgroup_copy_list(ListBase *outbase, ListBase *inbase)
 {
        bDeformGroup *defgroup, *defgroupn;
@@ -86,10 +83,10 @@
        }
        else {
                if (dvert_dst->dw)
-                       BLI_cellalloc_free(dvert_dst->dw);
+                       MEM_freeN(dvert_dst->dw);
 
                if (dvert_src->totweight)
-                       dvert_dst->dw= BLI_cellalloc_dupalloc(dvert_src->dw);
+                       dvert_dst->dw= MEM_dupallocN(dvert_src->dw);
                else
                        dvert_dst->dw= NULL;
 
@@ -587,10 +584,10 @@
        if (dw_new)
                return dw_new;
 
-       dw_new= 
BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dvert->totweight+1), 
"deformWeight");
+       dw_new= MEM_callocN(sizeof(MDeformWeight)*(dvert->totweight+1), 
"deformWeight");
        if (dvert->dw) {
                memcpy(dw_new, dvert->dw, 
sizeof(MDeformWeight)*dvert->totweight);
-               BLI_cellalloc_free(dvert->dw);
+               MEM_freeN(dvert->dw);
        }
        dvert->dw= dw_new;
        dw_new += dvert->totweight;
@@ -615,10 +612,10 @@
        if (!dvert || defgroup < 0)
                return;
 
-       dw_new = 
BLI_cellalloc_calloc(sizeof(MDeformWeight)*(dvert->totweight+1), 
"defvert_add_to group, new deformWeight");
+       dw_new = MEM_callocN(sizeof(MDeformWeight)*(dvert->totweight+1), 
"defvert_add_to group, new deformWeight");
        if(dvert->dw) {
                memcpy(dw_new, dvert->dw, 
sizeof(MDeformWeight)*dvert->totweight);
-               BLI_cellalloc_free(dvert->dw);
+               MEM_freeN(dvert->dw);
        }
        dvert->dw = dw_new;
        dw_new += dvert->totweight;
@@ -646,7 +643,7 @@
                 * this deform weight, and reshuffle the others.
                 */
                if (dvert->totweight) {
-                       dw_new = 
BLI_cellalloc_malloc(sizeof(MDeformWeight)*(dvert->totweight), __func__);
+                       dw_new = 
MEM_mallocN(sizeof(MDeformWeight)*(dvert->totweight), __func__);
                        if (dvert->dw) {
 #if 1                  /* since we dont care about order, swap this with the 
last, save a memcpy */
                                if (i != dvert->totweight) {
@@ -657,13 +654,13 @@
                                memcpy(dw_new, dvert->dw, 
sizeof(MDeformWeight)*i);
                                memcpy(dw_new+i, dvert->dw+i+1, 
sizeof(MDeformWeight)*(dvert->totweight-i));
 #endif
-                               BLI_cellalloc_free(dvert->dw);
+                               MEM_freeN(dvert->dw);
                        }
                        dvert->dw = dw_new;
                }
                else {
                        /* If there are no other deform weights left then just 
remove this one. */
-                       BLI_cellalloc_free(dvert->dw);
+                       MEM_freeN(dvert->dw);
                        dvert->dw = NULL;
                }
        }

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c      
2012-01-25 20:12:37 UTC (rev 43695)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c      
2012-01-25 20:18:12 UTC (rev 43696)
@@ -73,7 +73,6 @@
 #include "BLI_blenlib.h"
 #include "BLI_editVert.h"
 #include "BLI_math.h"
-#include "BLI_cellalloc.h"
 #include "BLI_array.h"
 #include "BLI_edgehash.h"
 
@@ -437,7 +436,7 @@
        
        for (i=0; i<copycount; i++){
                if (src[i].dw){
-                       dst[i].dw = BLI_cellalloc_calloc 
(sizeof(MDeformWeight)*src[i].totweight, "copy_deformWeight");
+                       dst[i].dw = MEM_callocN 
(sizeof(MDeformWeight)*src[i].totweight, "copy_deformWeight");
                        memcpy (dst[i].dw, src[i].dw, sizeof 
(MDeformWeight)*src[i].totweight);
                }
        }
@@ -456,7 +455,7 @@
 
        /* Free any special data from the verts */
        for (i=0; i<totvert; i++){
-               if (dvert[i].dw) BLI_cellalloc_free (dvert[i].dw);
+               if (dvert[i].dw) MEM_freeN (dvert[i].dw);
        }
        MEM_freeN (dvert);
 }
@@ -1897,9 +1896,9 @@
                                ld->totdisp = side*side;
                        
                                if (ld->disps)
-                                       BLI_cellalloc_free(ld->disps);
+                                       MEM_freeN(ld->disps);
                        
-                               ld->disps = 
BLI_cellalloc_calloc(sizeof(float)*3*side*side, "converted loop mdisps");
+                               ld->disps = 
MEM_callocN(sizeof(float)*3*side*side, "converted loop mdisps");
                                if (fd->disps) {
                                        memcpy(ld->disps, disps, 
sizeof(float)*3*side*side);
                                }

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/multires.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/multires.c  
2012-01-25 20:12:37 UTC (rev 43695)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/multires.c  
2012-01-25 20:18:12 UTC (rev 43696)
@@ -45,7 +45,6 @@
 #include "BLI_pbvh.h"
 #include "BLI_editVert.h"
 #include "BLI_utildefines.h"
-#include "BLI_cellalloc.h"
 
 #include "BKE_cdderivedmesh.h"
 #include "BKE_mesh.h"
@@ -327,10 +326,10 @@
        /* reallocate displacements to be filled in */
        for(i = 0; i < totloop; ++i) {
                int totdisp = multires_grid_tot[lvl];
-               float (*disps)[3] = BLI_cellalloc_calloc(sizeof(float) * 3 * 
totdisp, "multires disps");
+               float (*disps)[3] = MEM_callocN(sizeof(float) * 3 * totdisp, 
"multires disps");
 
                if(mdisps[i].disps)
-                       BLI_cellalloc_free(mdisps[i].disps);
+                       MEM_freeN(mdisps[i].disps);
 
                mdisps[i].disps = disps;
                mdisps[i].totdisp = totdisp;
@@ -409,7 +408,7 @@
                                        float (*disps)[3], (*ndisps)[3], 
(*hdisps)[3];
                                        int totdisp = multires_grid_tot[lvl];
 
-                                       disps = 
BLI_cellalloc_calloc(sizeof(float) * 3 * totdisp, "multires disps");
+                                       disps = MEM_callocN(sizeof(float) * 3 * 
totdisp, "multires disps");
 
                                        ndisps = disps;
                                        hdisps = mdisp->disps;
@@ -419,7 +418,7 @@
                                        ndisps += nsize*nsize;
                                        hdisps += hsize*hsize;
 
-                                       BLI_cellalloc_free(mdisp->disps);
+                                       MEM_freeN(mdisp->disps);
                                        mdisp->disps = disps;
                                        mdisp->totdisp = totdisp;
                                }
@@ -977,7 +976,7 @@
                        /* when adding new faces in edit mode, need to allocate 
disps */
                        if(!mdisp->disps) {
                                mdisp->totdisp = gridSize*gridSize;
-                               mdisp->disps = 
BLI_cellalloc_calloc(sizeof(float)*3*mdisp->totdisp, "disp in 
multires_set_space");
+                               mdisp->disps = 
MEM_callocN(sizeof(float)*3*mdisp->totdisp, "disp in multires_set_space");
                        }
 
                        dispgrid = mdisp->disps;
@@ -1179,7 +1178,7 @@
        int x, y, S;
        float (*disps)[3], (*out)[3], u = 0.0f, v = 0.0f; /* Quite gcc barking. 
*/
 
-       disps = BLI_cellalloc_calloc(sizeof(float) * 3 * newtotdisp, "multires 
disps");

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to