summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc-simple/alloc.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-11-23 21:35:34 -0500
committerMike Frysinger <vapier@gentoo.org>2009-11-23 21:35:34 -0500
commit00673f93826bf1fbde728d202c319a684bb87150 (patch)
tree2918312040781ebf7055ca83321605e7b110002d /libc/stdlib/malloc-simple/alloc.c
parentc5bc75430dccfaef12220311aa4853176a8a911b (diff)
nommu: use MAP_UNINITIALIZE for mallocs
Now that the kernel supports MAP_UNINITIALIZE, have the malloc places use it to get real uninitialized memory on no-mmu systems. This avoids a lot of normally useless overhead involved in zeroing out all of the memory (sometimes multiple times). Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'libc/stdlib/malloc-simple/alloc.c')
-rw-r--r--libc/stdlib/malloc-simple/alloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/stdlib/malloc-simple/alloc.c b/libc/stdlib/malloc-simple/alloc.c
index 36355c1e9..51da14ac8 100644
--- a/libc/stdlib/malloc-simple/alloc.c
+++ b/libc/stdlib/malloc-simple/alloc.c
@@ -36,7 +36,7 @@ void *malloc(size_t size)
#ifdef __ARCH_USE_MMU__
# define MMAP_FLAGS MAP_PRIVATE | MAP_ANONYMOUS
#else
-# define MMAP_FLAGS MAP_SHARED | MAP_ANONYMOUS
+# define MMAP_FLAGS MAP_SHARED | MAP_ANONYMOUS | MAP_UNINITIALIZE
#endif
result = mmap((void *) 0, size + sizeof(size_t), PROT_READ | PROT_WRITE,