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:
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h4
-rw-r--r--intern/guardedalloc/SConscript11
-rw-r--r--intern/guardedalloc/cpp/mallocn.cpp2
-rw-r--r--intern/guardedalloc/intern/mallocn.c14
4 files changed, 28 insertions, 3 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 6b78b0b6bdc..dfb8b2db1b1 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -150,6 +150,10 @@ extern "C" {
/*get the peak memory usage in bytes, including mmap allocations*/
uintptr_t MEM_get_peak_memory(void);
+#ifndef NDEBUG
+const char *MEM_name_ptr(void *vmemh);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/guardedalloc/SConscript b/intern/guardedalloc/SConscript
index 0c9c7d13608..74d6e07269f 100644
--- a/intern/guardedalloc/SConscript
+++ b/intern/guardedalloc/SConscript
@@ -2,7 +2,14 @@
Import('env')
-sources = env.Glob('intern/*.c')
+defs = []
+
+sources = ['intern/mallocn.c', 'intern/mmap_win.c']
+
+if env['WITH_BF_CXX_GUARDEDALLOC']:
+ sources.append('cpp/mallocn.cpp')
+ defs.append('WITH_CXX_GUARDEDALLOC')
+
incs = '.'
-env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defines=[], libtype=['intern','player'], priority = [5,150] )
+env.BlenderLib ('bf_intern_guardedalloc', sources, Split(incs), defs, libtype=['intern','player'], priority = [5,150] )
diff --git a/intern/guardedalloc/cpp/mallocn.cpp b/intern/guardedalloc/cpp/mallocn.cpp
index bf51409e84f..b4d19a62bdc 100644
--- a/intern/guardedalloc/cpp/mallocn.cpp
+++ b/intern/guardedalloc/cpp/mallocn.cpp
@@ -26,7 +26,7 @@
void* operator new (size_t size)
{
- return MEM_mallocN(size, "c++/anonymous");
+ return MEM_mallocN(size, "C++/anonymous");
}
/* not default but can be used when needing to set a string */
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 09f2d33a674..b213a1c3744 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -856,4 +856,18 @@ int MEM_get_memory_blocks_in_use(void)
return _totblock;
}
+#ifndef NDEBUG
+const char *MEM_name_ptr(void *vmemh)
+{
+ if (vmemh) {
+ MemHead *memh= vmemh;
+ memh--;
+ return memh->name;
+ }
+ else {
+ return "MEM_name_ptr(NULL)";
+ }
+}
+#endif
+
/* eof */