diff options
author | Geoffrey Bantle <hairbat@yahoo.com> | 2008-06-01 21:15:03 +0400 |
---|---|---|
committer | Geoffrey Bantle <hairbat@yahoo.com> | 2008-06-01 21:15:03 +0400 |
commit | 07b1608fbe52f729eae39c307060f92948aabf37 (patch) | |
tree | 96dcc1dde0038151362edfa437c843d042653e0d /source/blender/blenkernel/intern/bmesh_private.h | |
parent | 652ee1e31baa52c8e504bfcf3759ea94c7f5ab66 (diff) |
-> New memory allocator for Bmesh
Added a new pooling allocator for Bmesh based upon
the pool allocator availible in the Boost C++ library
as described here:
http://www.boost.org/doc/libs/1_34_0/libs/pool/doc/concepts.html
Each pool allocates elements of a fixed size, so every
element type in a mesh gets its own pool. For instance
verts occupy a different pool than edges. Each pool
is comprised of multiple arrays of a fixed size and allocating
/freeing elements is simple as removing or adding a head
to a linked list. Since the list of free elements is interleaved
throughout the unused space in the arrays, the overhead
for storing the free list is only 1 pointer total per pool.
This makes building/destroying bmesh structures much faster
and saves quite a bit of memory as well.
Diffstat (limited to 'source/blender/blenkernel/intern/bmesh_private.h')
-rw-r--r-- | source/blender/blenkernel/intern/bmesh_private.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/bmesh_private.h b/source/blender/blenkernel/intern/bmesh_private.h index ad90398bf66..ed58421ffb7 100644 --- a/source/blender/blenkernel/intern/bmesh_private.h +++ b/source/blender/blenkernel/intern/bmesh_private.h @@ -39,6 +39,15 @@ #include "BKE_bmesh.h" +/*MEMORY MANAGMENT*/ +struct BME_mempool; +typedef struct BME_mempool BME_mempool; + +struct BME_mempool *BME_mempool_create(int esize, int tote, int pchunk); +void BME_mempool_destroy(struct BME_mempool *pool); +void *BME_mempool_alloc(struct BME_mempool *pool); +void BME_mempool_free(struct BME_mempool *pool, void *address); + /*ALLOCATION/DEALLOCATION*/ struct BME_Vert *BME_addvertlist(struct BME_Mesh *bm, struct BME_Vert *example); struct BME_Edge *BME_addedgelist(struct BME_Mesh *bm, struct BME_Vert *v1, struct BME_Vert *v2, struct BME_Edge *example); @@ -49,7 +58,7 @@ void BME_free_vert(struct BME_Mesh *bm, struct BME_Vert *v); void BME_free_edge(struct BME_Mesh *bm, struct BME_Edge *e); void BME_free_poly(struct BME_Mesh *bm, struct BME_Poly *f); void BME_free_loop(struct BME_Mesh *bm, struct BME_Loop *l); -void BME_delete_loop(struct BME_Mesh *bm, struct BME_Loop *l); +//void BME_delete_loop(struct BME_Mesh *bm, struct BME_Loop *l); /*DOUBLE CIRCULAR LINKED LIST FUNCTIONS*/ void BME_cycle_append(void *h, void *nt); |