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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-05-19 22:37:31 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-05-19 22:37:31 +0400
commit30142a3b92ce75bc46a6d245a36e0ca82fc6fdb4 (patch)
tree67043e5890d5ef8e40403f5a1775ca393b05376a /intern/guardedalloc
parentc29a95acf9cdfcc7d10abf7603ec92d1e497c0aa (diff)
Apricot Branch
============== - Memory usage limit for undo, specified in megabytes, the default 0 means unlimited. - Multiple undo levels for image painting. Works separate from global undo similar to editmode undo, and undo for multiple images is supported.
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h6
-rw-r--r--intern/guardedalloc/intern/mallocn.c19
2 files changed, 23 insertions, 2 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index d004e7952cc..b1c7c3c47d3 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -123,6 +123,12 @@ extern "C" {
/** Attempt to enforce OSX (or other OS's) to have malloc and stack nonzero */
void MEM_set_memory_debug(void);
+ /* Memory usage stats
+ * - MEM_get_memory_in_use is all memory
+ * - MEM_get_mapped_memory_in_use is a subset of all memory */
+ unsigned long MEM_get_memory_in_use(void);
+ unsigned long MEM_get_mapped_memory_in_use(void);
+ int MEM_get_memory_blocks_in_use(void);
#ifdef __cplusplus
}
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 25f2fd8d269..d501e95f7c0 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -111,8 +111,8 @@ static const char *check_memlist(MemHead *memh);
/* --------------------------------------------------------------------- */
-volatile int totblock= 0;
-volatile unsigned long mem_in_use= 0, mmap_in_use= 0;
+static volatile int totblock= 0;
+static volatile unsigned long mem_in_use= 0, mmap_in_use= 0;
static volatile struct localListBase _membase;
static volatile struct localListBase *membase = &_membase;
@@ -696,4 +696,19 @@ static const char *check_memlist(MemHead *memh)
return(name);
}
+unsigned long MEM_get_memory_in_use(void)
+{
+ return mem_in_use;
+}
+
+unsigned long MEM_get_mapped_memory_in_use(void)
+{
+ return mmap_in_use;
+}
+
+int MEM_get_memory_blocks_in_use(void)
+{
+ return totblock;
+}
+
/* eof */