about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-11-30 21:08:37 +0000
committerEric Wong <e@80x24.org>2022-12-02 10:09:49 +0000
commit4fb41eb9e5eea9b959162ba2dab392429af9bd0e (patch)
tree819b934421f9a51214622f70362eb6198770925c
parentf84a516cdb3cebae0a43846cc95ec2426f67b685 (diff)
downloadmwrap-4fb41eb9e5eea9b959162ba2dab392429af9bd0e.tar.gz
Since Linux maps are file-backed, it won't provide an increase
in physical memory.  Using larger chunks reduces syscalls and
avoids hitting the Linux system-wide /proc/sys/vm/max_map_count
limit.

It's probably safe for all x86-64 systems these days, and 32-bit
is prone to overflow and not a target of this project (though
this project aims to make other projects suitable for
underpowered 32-bit systems).
-rw-r--r--mymalloc.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/mymalloc.h b/mymalloc.h
index ccf7ede..7b18486 100644
--- a/mymalloc.h
+++ b/mymalloc.h
@@ -29,6 +29,9 @@
 #include <fcntl.h>
 #include <errno.h>
 
+/* this is fine on most x86-64, especially with file-backed mmap(2) */
+#define DEFAULT_GRANULARITY (64U * 1024U * 1024U)
+
 #if !defined(MWRAP_FILE_BACKED) && defined(__linux__) && defined(O_TMPFILE)
 #        define MWRAP_FILE_BACKED 1
 #else