diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-05-19 22:37:31 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-05-19 22:37:31 +0400 |
commit | 30142a3b92ce75bc46a6d245a36e0ca82fc6fdb4 (patch) | |
tree | 67043e5890d5ef8e40403f5a1775ca393b05376a /intern/guardedalloc | |
parent | c29a95acf9cdfcc7d10abf7603ec92d1e497c0aa (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.h | 6 | ||||
-rw-r--r-- | intern/guardedalloc/intern/mallocn.c | 19 |
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 */ |