[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [26218] trunk/blender/intern/guardedalloc/ intern/mallocn.c: remove own experiemental code
Joseph Eagar
joeedh at gmail.com
Sun Jan 24 03:59:11 CET 2010
Revision: 26218
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26218
Author: joeedh
Date: 2010-01-24 03:59:09 +0100 (Sun, 24 Jan 2010)
Log Message:
-----------
remove own experiemental code
Modified Paths:
--------------
trunk/blender/intern/guardedalloc/intern/mallocn.c
Modified: trunk/blender/intern/guardedalloc/intern/mallocn.c
===================================================================
--- trunk/blender/intern/guardedalloc/intern/mallocn.c 2010-01-23 20:43:55 UTC (rev 26217)
+++ trunk/blender/intern/guardedalloc/intern/mallocn.c 2010-01-24 02:59:09 UTC (rev 26218)
@@ -37,8 +37,6 @@
#include <string.h> /* memcpy */
#include <stdarg.h>
-#include "../../../source/blender/blenlib/BLI_mempool.h"
-
/* mmap exception */
#if defined(WIN32)
#include <sys/types.h>
@@ -140,40 +138,6 @@
/* implementation */
/* --------------------------------------------------------------------- */
-#ifdef OPTIMIZE_SMALL_BLOCKS
-
-/*allocator for small objects
-
- basic strategy: most slowdowns from overuse of the system allocator tends
- to be from relatively small allocations.
-*/
-
-/*this is a little bit bigger then it perhaps needs to be, to accomodate vgroup
- allocations (which are one system alloc per vertex of a mesh, and is a major
- source of performance loss)*/
-#define SMALL_BLOCK_LIMIT 1024
-#define POOL_CHUNK_SIZE 512 /*size in number of elements, not bytes*/
-
-static BLI_mempool *alloc_pools[SMALL_BLOCK_LIMIT+sizeof(MemHead)+sizeof(MemTail)] = {NULL,};
-
-static void *mempool_alloc_mem(int size) {
- size += sizeof(MemHead)+sizeof(MemTail);
-
- if (!alloc_pools[size]) {
- alloc_pools[size] = BLI_mempool_create(size, 1, POOL_CHUNK_SIZE, 1);
- }
-
- return BLI_mempool_alloc(alloc_pools[size]);
-}
-
-static void mempool_free(void *mem, int size) {
- size += sizeof(MemHead)+sizeof(MemTail);
-
- BLI_mempool_free(alloc_pools[size], mem);
-}
-
-#endif
-
static void print_error(const char *str, ...)
{
char buf[1024];
@@ -290,14 +254,7 @@
len = (len + 3 ) & ~3; /* allocate in units of 4 */
-#ifdef OPTIMIZE_SMALL_BLOCKS
- if (len < SMALL_BLOCK_LIMIT)
- memh= mempool_alloc_mem(len);
- else
- memh= (MemHead *)malloc(len+sizeof(MemHead)+sizeof(MemTail));
-#else
memh= (MemHead *)malloc(len+sizeof(MemHead)+sizeof(MemTail));
-#endif
if(memh) {
make_memhead_header(memh, len, str);
@@ -319,16 +276,7 @@
len = (len + 3 ) & ~3; /* allocate in units of 4 */
-#ifdef OPTIMIZE_SMALL_BLOCKS
- if (len < SMALL_BLOCK_LIMIT) {
- memh= mempool_alloc_mem(len);
- memset(memh, 0, len+sizeof(MemHead)+sizeof(MemTail));
- } else {
- memh= (MemHead *)calloc(len+sizeof(MemHead)+sizeof(MemTail),1);
- }
-#else
memh= (MemHead *)calloc(len+sizeof(MemHead)+sizeof(MemTail),1);
-#endif
if(memh) {
make_memhead_header(memh, len, str);
@@ -682,13 +630,8 @@
mmap_in_use -= memh->len;
if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
printf("Couldn't unmap memory %s\n", memh->name);
- }
-#ifdef OPTIMIZE_SMALL_BLOCKS
- else if (memh->len < SMALL_BLOCK_LIMIT) {
- mempool_free(memh, memh->len);
- }
-#endif
- else {
+ }
+ else {
if(malloc_debug_memset && memh->len)
memset(memh+1, 255, memh->len);
free(memh);
More information about the Bf-blender-cvs
mailing list