about summary refs log tree commit diff stats
path: root/src/os/os_linux.c
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2025-09-10 15:44:29 +0200
committerptitSeb <sebastien.chev@gmail.com>2025-09-10 15:44:29 +0200
commit93fc3be3dfd87245e4d30acd68e143e284f9bfd2 (patch)
treec67841ad330940dd405310731b5288decf8685e7 /src/os/os_linux.c
parentd509261f81553a6b09ea219e1dbde9775df9a63e (diff)
downloadbox64-93fc3be3dfd87245e4d30acd68e143e284f9bfd2.tar.gz
box64-93fc3be3dfd87245e4d30acd68e143e284f9bfd2.zip
[BOX32] More work on box32 memory management and threads
Diffstat (limited to 'src/os/os_linux.c')
-rw-r--r--src/os/os_linux.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/os/os_linux.c b/src/os/os_linux.c
index d1a940b5..5c1ccac4 100644
--- a/src/os/os_linux.c
+++ b/src/os/os_linux.c
@@ -10,6 +10,8 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <errno.h>
+#include <sys/resource.h>
+#include <malloc.h>
 
 #include "os.h"
 #include "signals.h"
@@ -133,6 +135,16 @@ const char* GetNativeName(void* p)
 void PersonalityAddrLimit32Bit(void)
 {
     personality(ADDR_LIMIT_32BIT);
+    /*struct rlimit l;
+    if(getrlimit(RLIMIT_DATA, &l)<0) return;  // failed
+    if(l.rlim_max>3*1024*1024*1024LL) {
+        l.rlim_cur = 3*1024*1024*1024LL;
+        setrlimit(RLIMIT_DATA, &l);
+    }*/
+    // setting 32bits malloc options
+    mallopt(M_ARENA_TEST, 2);
+    mallopt(M_ARENA_MAX, 2);
+    mallopt(M_MMAP_THRESHOLD, 128*1024);
 }
 
 int IsAddrElfOrFileMapped(uintptr_t addr)