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:
authorCampbell Barton <ideasman42@gmail.com>2015-06-21 05:29:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-06-21 05:33:55 +0300
commit8d752141ce7b081ce14dac6366510ba437a76380 (patch)
tree733829fb37d416901a35d71fb9954fa43899a300 /intern/guardedalloc
parente3d6269ec4b74bf6a210396b3d733f88f30e2394 (diff)
Support for platforms /wo malloc_usable_size
Was only used for stats, netbsd doesn't define this function.
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r--intern/guardedalloc/intern/mallocn_guarded_impl.c2
-rw-r--r--intern/guardedalloc/intern/mallocn_intern.h4
2 files changed, 5 insertions, 1 deletions
diff --git a/intern/guardedalloc/intern/mallocn_guarded_impl.c b/intern/guardedalloc/intern/mallocn_guarded_impl.c
index 88d6f35d438..1933e9d3ee3 100644
--- a/intern/guardedalloc/intern/mallocn_guarded_impl.c
+++ b/intern/guardedalloc/intern/mallocn_guarded_impl.c
@@ -711,10 +711,12 @@ void MEM_guarded_printmemlist_stats(void)
totpb++;
pb++;
+#ifdef USE_MALLOC_USABLE_SIZE
if (!membl->mmap && membl->alignment == 0) {
mem_in_use_slop += (sizeof(MemHead) + sizeof(MemTail) +
malloc_usable_size((void *)membl)) - membl->len;
}
+#endif
if (membl->next)
membl = MEMNEXT(membl->next);
diff --git a/intern/guardedalloc/intern/mallocn_intern.h b/intern/guardedalloc/intern/mallocn_intern.h
index 6cab1f01b70..3f7e462c1c7 100644
--- a/intern/guardedalloc/intern/mallocn_intern.h
+++ b/intern/guardedalloc/intern/mallocn_intern.h
@@ -50,6 +50,7 @@
#endif
#undef HAVE_MALLOC_STATS
+#define USE_MALLOC_USABLE_SIZE /* internal, when we have malloc_usable_size() */
#if defined(__linux__) || (defined(__FreeBSD_kernel__) && !defined(__FreeBSD__)) || defined(__GLIBC__)
# include <malloc.h>
@@ -63,7 +64,8 @@
# include <malloc.h>
# define malloc_usable_size _msize
#else
-# error "We don't know how to use malloc_usable_size on your platform"
+# pragma message "We don't know how to use malloc_usable_size on your platform"
+# undef USE_MALLOC_USABLE_SIZE
#endif
/* Blame Microsoft for LLP64 and no inttypes.h, quick workaround needed: */