diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-23 04:08:37 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-01-23 04:13:46 +0400 |
commit | 282ad434a8bca760372f98ceec8a15725bf30bd1 (patch) | |
tree | 6c4f61a78590d314b980b77a974ceffeffd9c1e5 /intern/guardedalloc/intern/mallocn_lockfree_impl.c | |
parent | 28ca299d4dfc392462efd598f14b825ba8bd21ea (diff) |
Memory allocation: do not use mmap for memory allocation on 64 bit.
On Windows we can only do mmap memory allocation up to 4 GB, which causes a
crash when doing very large renders on 64 bit systems with a lot of memory.
As far as I can tell the reason to use mmap is to get around address space
limitation on some 32 bit operating systems, and I can't see a reason to use
it on 64 bit. For the original explanation see here:
http://orange.blender.org/blog/stupid-memory-problems
Fixes T37841.
Diffstat (limited to 'intern/guardedalloc/intern/mallocn_lockfree_impl.c')
-rw-r--r-- | intern/guardedalloc/intern/mallocn_lockfree_impl.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/intern/guardedalloc/intern/mallocn_lockfree_impl.c b/intern/guardedalloc/intern/mallocn_lockfree_impl.c index 44f51a34134..2c7c087966a 100644 --- a/intern/guardedalloc/intern/mallocn_lockfree_impl.c +++ b/intern/guardedalloc/intern/mallocn_lockfree_impl.c @@ -265,6 +265,12 @@ void *MEM_lockfree_mapallocN(size_t len, const char *str) { MemHead *memh; + /* on 64 bit, simply use calloc instead, as mmap does not support + * allocating > 4 GB on Windows. the only reason mapalloc exists + * is to get around address space limitations in 32 bit OSes. */ + if(sizeof(void*) >= 8) + return MEM_lockfree_callocN(len, str); + len = SIZET_ALIGN_4(len); #if defined(WIN32) |