Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-02-16 20:51:01 +0300
committerTon Roosendaal <ton@blender.org>2006-02-16 20:51:01 +0300
commitfe036a0538860bf4f0b8e87d70046ff2a75f5f28 (patch)
treec6838cde34a609ea4832b98303c683fe90fd3edd
parent7f4b01ccf076998cac98c52aa6701f35e1c2500f (diff)
Added new malloc type in our MEM module; using the unix feature 'mmap'.
In Orange we've been fighting the past weeks with memory usage a lot... at the moment incredible huge scenes are being rendered, with multiple layers and all compositing, stressing limits of memory a lot. I had hoped that less frequently used blocks would be swapped away nicely, so fragmented memory could survive. Unfortunately (in OSX) the malloc range is limited to 2 GB only (upped half of address space). Other OS's have a limit too, but typically larger afaik. Now here's mmap to the rescue! It has a very nice feature to map to a virtual (non existing) file, allowing to allocate disk-mapped memory on the fly. For as long there's real memory it works nearly as fast as a regular malloc, and when you go to the swap boundary, it knows nicely what to swap first. The upcoming commit will use mmap for all large memory blocks, like the composit stack, render layers, lamp buffers and images. Tested here on my 1 GB system, and compositing huge images with a total of 2.5 gig still works acceptable here. :) http://www.blender.org/bf/memory.jpg This is a silly composit test, using 64 MB images with a load of nodes. Check the header print... the (2323.33M) is the mmap disk-cache in use. BTW: note that is still limited to the virtual address space of 4 GB. The new call is: MEM_mapalloc() Per definition, mmap() returns zero'ed memory, so a calloc isn't required. For Windows there's no mmap() available, but I'm pretty sure there's an equivalent. Windows gurus here are invited to insert that here in code! At the moment it's nicely ifdeffed, so for Windows the mmap defaults to a regular alloc.
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h13
-rw-r--r--intern/guardedalloc/intern/mallocn.c145
-rw-r--r--source/blender/blenkernel/intern/node_composite.c15
-rw-r--r--source/blender/blenlib/BLI_threads.h1
-rw-r--r--source/blender/blenlib/intern/threads.c8
-rw-r--r--source/blender/imbuf/intern/allocimbuf.c8
-rw-r--r--source/blender/render/intern/source/pipeline.c10
-rw-r--r--source/blender/render/intern/source/shadbuf.c2
-rw-r--r--source/blender/render/intern/source/zbuf.c12
-rw-r--r--source/blender/src/header_info.c23
-rw-r--r--source/blender/src/renderwin.c15
11 files changed, 151 insertions, 101 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index e909e7eee45..c9338d0ae8a 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -87,12 +87,17 @@ extern "C" {
* Allocate a block of memory of size len, with tag name str. The
* memory is cleared. The name must be static, because only a
* pointer to it is stored ! */
- void *MEM_callocN(unsigned int len, char * str);
+ void *MEM_callocN(unsigned int len, const char * str);
/** Allocate a block of memory of size len, with tag name str. The
- * name must be a static, because only a pointer to it is stored !
- * */
- void *MEM_mallocN(unsigned int len, char * str);
+ * name must be a static, because only a pointer to it is stored !
+ * */
+ void *MEM_mallocN(unsigned int len, const char * str);
+
+ /** Same as callocN, clears memory and uses mmap (disk cached) if supported.
+ Can be free'd with MEM_freeN as usual.
+ * */
+ void *MEM_mapallocN(unsigned int len, const char * str);
/** Print a list of the names and sizes of all allocated memory
* blocks. */
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index cd1917cd3c7..763cb655c8d 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -40,8 +40,11 @@
#include <string.h> /* memcpy */
#include <stdarg.h>
-#ifdef HAVE_CONFIG_H
-#include <config.h>
+/* mmap exception */
+#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
+#else
+#include <sys/types.h>
+#include <sys/mman.h>
#endif
#include "MEM_guardedalloc.h"
@@ -60,20 +63,22 @@ typedef struct localListBase
void *first, *last;
} localListBase;
+ /* note: keep this struct aligned (e.g., irix/gcc) - Hos */
typedef struct MemHead {
int tag1;
int len;
struct MemHead *next,*prev;
- char * name;
- char * nextname;
+ const char * name;
+ const char * nextname;
int tag2;
- int pad; /* keep this in, due to alignment issues (e.g., irix/gcc) - Hos */
+ int mmap; /* if true, memory was mmapped */
} MemHead;
typedef struct MemTail {
int tag3, pad;
} MemTail;
+
/* --------------------------------------------------------------------- */
/* local functions */
/* --------------------------------------------------------------------- */
@@ -81,8 +86,8 @@ typedef struct MemTail {
static void addtail(localListBase *listbase, void *vlink);
static void remlink(localListBase *listbase, void *vlink);
static void rem_memblock(MemHead *memh);
-static void MemorY_ErroR(char *block, char *error);
-static char *check_memlist(MemHead *memh);
+static void MemorY_ErroR(const char *block, const char *error);
+static const char *check_memlist(MemHead *memh);
/* --------------------------------------------------------------------- */
/* locally used defines */
@@ -107,7 +112,7 @@ static char *check_memlist(MemHead *memh);
int totblock= 0;
-int mem_in_use= 0;
+unsigned long mem_in_use= 0, mmap_in_use= 0;
static struct localListBase _membase;
static struct localListBase *membase = &_membase;
@@ -130,7 +135,7 @@ static void (*error_callback)(char *) = NULL;
/* implementation */
/* --------------------------------------------------------------------- */
-static void print_error(char *str, ...)
+static void print_error(const char *str, ...)
{
char buf[1024];
va_list ap;
@@ -144,7 +149,7 @@ static void print_error(char *str, ...)
int MEM_check_memory_integrity()
{
- char* err_val = NULL;
+ const char* err_val = NULL;
MemHead* listend;
/* check_memlist starts from the front, and runs until it finds
* the requested chunk. For this test, that's the last one. */
@@ -180,76 +185,94 @@ void *MEM_dupallocN(void *vmemh)
if (vmemh) {
MemHead *memh= vmemh;
memh--;
-
- newp= MEM_mallocN(memh->len, "dupli_alloc");
+
+ if(memh->mmap)
+ newp= MEM_mapallocN(memh->len, "dupli_alloc");
+ else
+ newp= MEM_mallocN(memh->len, "dupli_mapalloc");
memcpy(newp, vmemh, memh->len);
}
return newp;
}
-void *MEM_mallocN(unsigned int len, char *str)
+static void make_memhead_header(MemHead *memh, unsigned int len, const char *str)
{
- MemHead *memh;
MemTail *memt;
+
+ memh->tag1 = MEMTAG1;
+ memh->name = str;
+ memh->nextname = 0;
+ memh->len = len;
+ memh->mmap = 0;
+ memh->tag2 = MEMTAG2;
+
+ memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + len);
+ memt->tag3 = MEMTAG3;
+
+ addtail(membase,&memh->next);
+ if (memh->next) memh->nextname = MEMNEXT(memh->next)->name;
+
+ totblock++;
+ mem_in_use += len;
+}
+
+void *MEM_mallocN(unsigned int len, const char *str)
+{
+ MemHead *memh;
len = (len + 3 ) & ~3; /* allocate in units of 4 */
memh= (MemHead *)malloc(len+sizeof(MemHead)+sizeof(MemTail));
- if(memh!=0) {
- memh->tag1 = MEMTAG1;
- memh->name = str;
- memh->nextname = 0;
- memh->len = len;
-/* memh->level = 0; */
- memh->tag2 = MEMTAG2;
-
- memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + len);
- memt->tag3 = MEMTAG3;
-
- addtail(membase,&memh->next);
- if (memh->next) memh->nextname = MEMNEXT(memh->next)->name;
-
- totblock++;
- mem_in_use += len;
+ if(memh) {
+ make_memhead_header(memh, len, str);
return (++memh);
}
print_error("Malloc returns nill: len=%d in %s\n",len,str);
- return 0;
+ return NULL;
}
-void *MEM_callocN(unsigned int len, char *str)
+void *MEM_callocN(unsigned int len, const char *str)
{
MemHead *memh;
- MemTail *memt;
len = (len + 3 ) & ~3; /* allocate in units of 4 */
memh= (MemHead *)calloc(len+sizeof(MemHead)+sizeof(MemTail),1);
- if(memh!=0) {
- memh->tag1 = MEMTAG1;
- memh->name = str;
- memh->nextname = 0;
- memh->len = len;
-/* memh->level = 0; */
- memh->tag2 = MEMTAG2;
-
- memt = (MemTail *)(((char *) memh) + sizeof(MemHead) + len);
- memt->tag3 = MEMTAG3;
-
- addtail(membase,&memh->next);
- if (memh->next) memh->nextname = MEMNEXT(memh->next)->name;
-
- totblock++;
- mem_in_use += len;
+ if(memh) {
+ make_memhead_header(memh, len, str);
return (++memh);
}
print_error("Calloc returns nill: len=%d in %s\n",len,str);
return 0;
}
+/* note; mmap returns zero'd memory */
+void *MEM_mapallocN(unsigned int len, const char *str)
+{
+#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
+ return MEM_callocN(len, str);
+#else
+ MemHead *memh;
+
+ len = (len + 3 ) & ~3; /* allocate in units of 4 */
+
+ memh= mmap(0, len+sizeof(MemHead)+sizeof(MemTail),
+ PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANON, -1, 0);
+
+ if(memh!=(MemHead *)-1) {
+ make_memhead_header(memh, len, str);
+ memh->mmap= 1;
+ mmap_in_use += len;
+ return (++memh);
+ }
+ print_error("Mapalloc returns nill: len=%d in %s\n",len, str);
+ return NULL;
+#endif
+}
+
void MEM_printmemlist()
{
@@ -270,9 +293,9 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
short error = 0;
MemTail *memt;
MemHead *memh= vmemh;
- char *name;
+ const char *name;
- if (memh == 0){
+ if (memh == NULL){
MemorY_ErroR("free","attempt to free NULL pointer");
/* print_error(err_stream, "%d\n", (memh+4000)->tag1); */
return(-1);
@@ -304,7 +327,7 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
memh->tag1 = MEMFREE;
memh->tag2 = MEMFREE;
memt->tag3 = MEMFREE;
- /* na tags !!! */
+ /* after tags !!! */
rem_memblock(memh);
return(0);
@@ -323,7 +346,7 @@ short MEM_freeN(void *vmemh) /* anders compileertie niet meer */
}
totblock--;
- /* hier moet een DUMP plaatsvinden */
+ /* here a DUMP should happen */
return(error);
}
@@ -371,18 +394,24 @@ static void rem_memblock(MemHead *memh)
totblock--;
mem_in_use -= memh->len;
- free(memh);
+ if(memh->mmap) {
+ mmap_in_use -= memh->len;
+ if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
+ printf("Couldn't unmap memory %s\n", memh->name);
+ }
+ else
+ free(memh);
}
-static void MemorY_ErroR(char *block, char *error)
+static void MemorY_ErroR(const char *block, const char *error)
{
- print_error("Memoryblock %s: %s\n",block,error);
+ print_error("Memoryblock %s: %s\n",block, error);
}
-static char *check_memlist(MemHead *memh)
+static const char *check_memlist(MemHead *memh)
{
MemHead *forw,*back,*forwok,*backok;
- char *name;
+ const char *name;
forw = membase->first;
if (forw) forw = MEMNEXT(forw);
diff --git a/source/blender/blenkernel/intern/node_composite.c b/source/blender/blenkernel/intern/node_composite.c
index eb23b533723..78f97465cd0 100644
--- a/source/blender/blenkernel/intern/node_composite.c
+++ b/source/blender/blenkernel/intern/node_composite.c
@@ -84,13 +84,13 @@ static CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
cbuf->type= type;
if(alloc) {
if(cbuf->type==CB_RGBA)
- cbuf->rect= MEM_mallocT(4*sizeof(float)*sizex*sizey, "compbuf RGBA rect");
+ cbuf->rect= MEM_mapallocT(4*sizeof(float)*sizex*sizey, "compbuf RGBA rect");
else if(cbuf->type==CB_VEC3)
- cbuf->rect= MEM_mallocT(3*sizeof(float)*sizex*sizey, "compbuf Vector3 rect");
+ cbuf->rect= MEM_mapallocT(3*sizeof(float)*sizex*sizey, "compbuf Vector3 rect");
else if(cbuf->type==CB_VEC2)
- cbuf->rect= MEM_mallocT(2*sizeof(float)*sizex*sizey, "compbuf Vector2 rect");
+ cbuf->rect= MEM_mapallocT(2*sizeof(float)*sizex*sizey, "compbuf Vector2 rect");
else
- cbuf->rect= MEM_mallocT(sizeof(float)*sizex*sizey, "compbuf Fac rect");
+ cbuf->rect= MEM_mapallocT(sizeof(float)*sizex*sizey, "compbuf Fac rect");
cbuf->malloc= 1;
}
cbuf->disprect.xmin= 0;
@@ -113,6 +113,7 @@ void free_compbuf(CompBuf *cbuf)
{
if(cbuf->malloc && cbuf->rect)
MEM_freeT(cbuf->rect);
+
MEM_freeT(cbuf);
}
@@ -1869,7 +1870,7 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, float
float *src, *dest, *wb;
wbuf= alloc_compbuf(imgx, imgy, CB_VAL, 1);
- memset(wbuf->rect, sizeof(float)*imgx*imgy, 0);
+// memset(wbuf->rect, sizeof(float)*imgx*imgy, 0);
/* horizontal */
radx = (float)nbd->sizex;
@@ -1894,7 +1895,7 @@ static void bloom_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, float
// refd= ref->rect;
src= img->rect;
- memset(new->rect, 4*imgx*imgy, 0);
+// memset(new->rect, 4*imgx*imgy, 0);
radxf= (float)radx;
radyf= (float)rady;
@@ -2060,7 +2061,7 @@ static void bokeh_single_image(CompBuf *new, CompBuf *img, float fac, NodeBlurDa
for(j= 4*radx*rady -1; j>=0; j--)
gausstab[j]*= val;
- memset(new->rect, 4*imgx*imgy, 0);
+// memset(new->rect, 4*imgx*imgy, 0);
for (y = -rady+1; y < imgy+rady-1; y++) {
diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h
index 3791d92d6fc..6cbac55ac02 100644
--- a/source/blender/blenlib/BLI_threads.h
+++ b/source/blender/blenlib/BLI_threads.h
@@ -45,6 +45,7 @@ void BLI_unlock_thread (void);
/* threadsafe version of MEM_malloc and friends */
void *MEM_mallocT(int len, char *name);
void *MEM_callocT(int len, char *name);
+void *MEM_mapallocT(int len, char *name);
void MEM_freeT(void *poin);
#endif
diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c
index d1a9183518e..712a6529348 100644
--- a/source/blender/blenlib/intern/threads.c
+++ b/source/blender/blenlib/intern/threads.c
@@ -220,6 +220,14 @@ void *MEM_callocT(int len, char *name)
if(_malloc_lock) SDL_mutexV(_malloc_lock);
return mem;
}
+void *MEM_mapallocT(int len, char *name)
+{
+ void *mem;
+ if(_malloc_lock) SDL_mutexP(_malloc_lock);
+ mem= MEM_mapallocN(len, name);
+ if(_malloc_lock) SDL_mutexV(_malloc_lock);
+ return mem;
+}
void MEM_freeT(void *poin)
{
if(_malloc_lock) SDL_mutexP(_malloc_lock);
diff --git a/source/blender/imbuf/intern/allocimbuf.c b/source/blender/imbuf/intern/allocimbuf.c
index 0d1255d8da0..c8cb654c1e8 100644
--- a/source/blender/imbuf/intern/allocimbuf.c
+++ b/source/blender/imbuf/intern/allocimbuf.c
@@ -166,7 +166,7 @@ short addzbufImBuf(struct ImBuf * ibuf)
IMB_freezbufImBuf(ibuf);
size = ibuf->x * ibuf->y * sizeof(unsigned int);
- if ( (ibuf->zbuf = MEM_mallocN(size, "addzbufImBuf")) ){
+ if ( (ibuf->zbuf = MEM_mapallocN(size, "addzbufImBuf")) ){
ibuf->mall |= IB_zbuf;
ibuf->flags |= IB_zbuf;
return (TRUE);
@@ -184,7 +184,7 @@ short addzbuffloatImBuf(struct ImBuf * ibuf)
IMB_freezbuffloatImBuf(ibuf);
size = ibuf->x * ibuf->y * sizeof(float);
- if ( (ibuf->zbuf_float = MEM_mallocN(size, "addzbuffloatImBuf")) ){
+ if ( (ibuf->zbuf_float = MEM_mapallocN(size, "addzbuffloatImBuf")) ){
ibuf->mall |= IB_zbuffloat;
ibuf->flags |= IB_zbuffloat;
return (TRUE);
@@ -263,7 +263,7 @@ short imb_addrectfloatImBuf(struct ImBuf * ibuf)
size = ibuf->x * ibuf->y;
size = size * 4 * sizeof(float);
- if ( (ibuf->rect_float = MEM_mallocN(size, "imb_addrectfloatImBuf")) ){
+ if ( (ibuf->rect_float = MEM_mapallocN(size, "imb_addrectfloatImBuf")) ){
ibuf->mall |= IB_rectfloat;
ibuf->flags |= IB_rectfloat;
return (TRUE);
@@ -283,7 +283,7 @@ short imb_addrectImBuf(struct ImBuf * ibuf)
size = ibuf->x * ibuf->y;
size = size * sizeof(unsigned int);
- if ( (ibuf->rect = MEM_mallocN(size, "imb_addrectImBuf")) ){
+ if ( (ibuf->rect = MEM_mapallocN(size, "imb_addrectImBuf")) ){
ibuf->mall |= IB_rect;
ibuf->flags |= IB_rect;
if (ibuf->depth > 32) return (addzbufImBuf(ibuf));
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 25a4af1fdd3..c326f8627d9 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -183,12 +183,12 @@ static void render_layer_add_pass(RenderLayer *rl, int rectsize, int passtype, c
int x;
/* initialize to max speed */
- rect= rpass->rect= MEM_mallocT(sizeof(float)*rectsize, mallocstr);
+ rect= rpass->rect= MEM_mapallocT(sizeof(float)*rectsize, mallocstr);
for(x= rectsize-1; x>=0; x--)
rect[x]= PASS_VECTOR_MAX;
}
else
- rpass->rect= MEM_callocT(sizeof(float)*rectsize, mallocstr);
+ rpass->rect= MEM_mapallocT(sizeof(float)*rectsize, mallocstr);
}
float *RE_RenderLayerGetPass(RenderLayer *rl, int passtype)
@@ -244,7 +244,7 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop)
rl->layflag= srl->layflag;
rl->passflag= srl->passflag;
- rl->rectf= MEM_callocT(rectx*recty*sizeof(float)*4, "layer float rgba");
+ rl->rectf= MEM_mapallocT(rectx*recty*sizeof(float)*4, "layer float rgba");
if(srl->passflag & SCE_PASS_Z)
render_layer_add_pass(rl, rectx*recty, SCE_PASS_Z, "Layer float Z");
@@ -271,7 +271,7 @@ static RenderResult *new_render_result(Render *re, rcti *partrct, int crop)
rl= MEM_callocT(sizeof(RenderLayer), "new render layer");
BLI_addtail(&rr->layers, rl);
- rl->rectf= MEM_callocT(rectx*recty*sizeof(float)*4, "prev/env float rgba");
+ rl->rectf= MEM_mapallocT(rectx*recty*sizeof(float)*4, "prev/env float rgba");
/* note, this has to be in sync with scene.c */
rl->lay= (1<<20) -1;
@@ -1159,7 +1159,7 @@ static void do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh)
int dofree = 0;
/* note; the way it gets 32 bits rects is weak... */
if(rres.rect32==NULL) {
- rres.rect32= MEM_mallocT(sizeof(int)*rres.rectx*rres.recty, "temp 32 bits rect");
+ rres.rect32= MEM_mapallocT(sizeof(int)*rres.rectx*rres.recty, "temp 32 bits rect");
dofree = 1;
}
RE_ResultGet32(re, rres.rect32);
diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c
index 616d43fac29..918f930ee78 100644
--- a/source/blender/render/intern/source/shadbuf.c
+++ b/source/blender/render/intern/source/shadbuf.c
@@ -290,7 +290,7 @@ void makeshadowbuf(Render *re, LampRen *lar)
MTC_Mat4SwapMat4(shb->persmat, re->winmat);
/* zbuffering */
- rectz= MEM_mallocN(sizeof(int)*shb->size*shb->size, "makeshadbuf");
+ rectz= MEM_mapallocN(sizeof(int)*shb->size*shb->size, "makeshadbuf");
project_renderdata(re, projectvert, 0, 0);
diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c
index 528f24295b5..aeee85a45db 100644
--- a/source/blender/render/intern/source/zbuf.c
+++ b/source/blender/render/intern/source/zbuf.c
@@ -2084,11 +2084,11 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
zspan.zofsy= 0.0f;
/* the buffers */
- rectz= MEM_mallocT(sizeof(float)*xsize*ysize, "zbuf accum");
+ rectz= MEM_mapallocT(sizeof(float)*xsize*ysize, "zbuf accum");
zspan.rectz= (int *)rectz;
- rectmove= MEM_callocT(xsize*ysize, "rectmove");
- rectdraw= MEM_mallocT(sizeof(DrawBufPixel)*xsize*ysize, "rect draw");
+ rectmove= MEM_mapallocT(xsize*ysize, "rectmove");
+ rectdraw= MEM_mapallocT(sizeof(DrawBufPixel)*xsize*ysize, "rect draw");
zspan.rectp= (int *)rectdraw;
/* min speed? then copy speedbuffer to recalculate speed vectors */
@@ -2096,7 +2096,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
float minspeed= (float)nbd->minspeed;
float minspeedsq= minspeed*minspeed;
- minvecbufrect= MEM_mallocT(4*sizeof(float)*xsize*ysize, "minspeed buf");
+ minvecbufrect= MEM_mapallocT(4*sizeof(float)*xsize*ysize, "minspeed buf");
dvec1= vecbufrect;
dvec2= minvecbufrect;
@@ -2122,7 +2122,7 @@ void RE_zbuf_accumulate_vecblur(NodeBlurData *nbd, int xsize, int ysize, float *
}
/* make vertex buffer with averaged speed and zvalues */
- rectvz= MEM_callocT(5*sizeof(float)*(xsize+1)*(ysize+1), "vertices");
+ rectvz= MEM_mapallocT(5*sizeof(float)*(xsize+1)*(ysize+1), "vertices");
dvz= rectvz;
for(y=0; y<=ysize; y++) {
@@ -2625,7 +2625,7 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeResult *shr, int mask, int
return retval;
}
-#define MAX_ZROW 1000
+#define MAX_ZROW 2000
/* main render call to fill in pass the full transparent layer */
void zbuffer_transp_shade(RenderPart *pa, RenderLayer *rl, float *pass)
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
index 15ebfe0109f..06d75d1ab0d 100644
--- a/source/blender/src/header_info.c
+++ b/source/blender/src/header_info.c
@@ -1729,15 +1729,20 @@ static void info_text(int x, int y)
{
Object *ob= OBACT;
extern float hashvectf[];
- extern int mem_in_use;
+ extern unsigned long mem_in_use, mmap_in_use;
unsigned int swatch_color;
float fac1, fac2, fac3;
- char infostr[300];
- char *headerstr;
+ char infostr[300], memstr[64];
+ char *headerstr, *s;
int hsize;
+ s= memstr + sprintf(memstr," | Mem:%.2fM ", ((mem_in_use-mmap_in_use)>>10)/1024.0);
+ if(mmap_in_use)
+ sprintf(s,"(%.2fM) ", ((mmap_in_use)>>10)/1024.0);
+
+
if(G.obedit) {
- char *s = infostr;
+ s = infostr;
s+= sprintf(s, "%s", G.editModeTitleExtra);
if(G.obedit->type==OB_MESH) {
@@ -1757,15 +1762,15 @@ static void info_text(int x, int y)
s+= sprintf(s,"Ve:%d-%d", G.totvertsel, G.totvert);
}
- sprintf(s," | Mem:%.2fM ", (mem_in_use>>10)/1024.0);
+ strcat(s, memstr);
}
else if(ob && (ob->flag & OB_POSEMODE)) {
- sprintf(infostr,"Bo:%d-%d | Mem:%.2fM ",
- G.totbonesel, G.totbone, (mem_in_use>>10)/1024.0);
+ sprintf(infostr,"Bo:%d-%d %s",
+ G.totbonesel, G.totbone, memstr);
}
else {
- sprintf(infostr,"Ve:%d | Fa:%d | Ob:%d-%d | La:%d | Mem:%.2fM | Time:%s | ",
- G.totvert, G.totface, G.totobj, G.totobjsel, G.totlamp, (mem_in_use>>10)/1024.0, info_time_str);
+ sprintf(infostr,"Ve:%d | Fa:%d | Ob:%d-%d | La:%d %s | Time:%s | ",
+ G.totvert, G.totface, G.totobj, G.totobjsel, G.totlamp, memstr, info_time_str);
}
if(ob) {
strcat(infostr, ob->id.name+2);
diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c
index 428572e2317..54f39ffd32f 100644
--- a/source/blender/src/renderwin.c
+++ b/source/blender/src/renderwin.c
@@ -827,22 +827,23 @@ static void renderwin_progress_display_cb(RenderResult *rr, rcti *rect)
static void printrenderinfo_cb(RenderStats *rs)
{
extern char info_time_str[32]; // header_info.c
- extern int mem_in_use;
- static float megs_used_memory;
+ extern unsigned long mem_in_use, mmap_in_use;
+ static float megs_used_memory, mmap_used_memory;
char str[300], *spos= str;
+ megs_used_memory= (mem_in_use-mmap_in_use)/(1024.0*1024.0);
+ mmap_used_memory= (mmap_in_use)/(1024.0*1024.0);
+
if(render_win) {
- megs_used_memory= mem_in_use/(1024.0*1024.0);
-
if(G.scene->lay & 0xFF000000)
spos+= sprintf(spos, "Localview | ");
else if(G.scene->r.scemode & R_SINGLE_LAYER)
spos+= sprintf(spos, "Single Layer | ");
if(rs->tothalo)
- spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d Ha:%d La:%d Mem:%.2fM", (G.scene->r.cfra), rs->totvert, rs->totface, rs->tothalo, rs->totlamp, megs_used_memory);
+ spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d Ha:%d La:%d Mem:%.2fM (%.2fM)", (G.scene->r.cfra), rs->totvert, rs->totface, rs->tothalo, rs->totlamp, megs_used_memory, mmap_used_memory);
else
- spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d La:%d Mem:%.2fM", (G.scene->r.cfra), rs->totvert, rs->totface, rs->totlamp, megs_used_memory);
+ spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d La:%d Mem:%.2fM (%.2fM)", (G.scene->r.cfra), rs->totvert, rs->totface, rs->totlamp, megs_used_memory, mmap_used_memory);
BLI_timestr(rs->lastframetime, info_time_str);
spos+= sprintf(spos, " Time:%s ", info_time_str);
@@ -861,7 +862,7 @@ static void printrenderinfo_cb(RenderStats *rs)
/* temporal render debug printing, needed for testing orange renders atm... will be gone soon (or option) */
if(G.rt==7 && rs->convertdone) {
spos= str;
- spos+= sprintf(spos, "Fra:%d Mem:%.2fM ", G.scene->r.cfra, megs_used_memory);
+ spos+= sprintf(spos, "Fra:%d Mem:%.2fM (%.2fM)", G.scene->r.cfra, megs_used_memory, mmap_used_memory);
if(rs->infostr) {
spos+= sprintf(spos, " | %s", rs->infostr);