diff -urZ --new-file mimalloc-ad058291953dbe00d7a7d7f786d17f7f4c563033/src/options.c mimalloc-zoox/src/options.c
--- mimalloc-ad058291953dbe00d7a7d7f786d17f7f4c563033/src/options.c	2020-11-06 17:49:10.000000000 -0800
+++ mimalloc-zoox/src/options.c	2020-12-01 09:51:04.361190647 -0800
@@ -485,13 +485,68 @@
 }
 #endif
 
+#define MI_STRCMP(a, b) \
+  mi_strnicmp((a), (b), strlen(a))
+
+// ZOOX(rrishel)
+// Override options fetched from environment.
+static bool zoox_getenv(const char* name, char* result, size_t result_size) {
+  bool ret = false;
+  // Override mimalloc_reserve_os_memory with value from zoox_alloc_size.
+  if (MI_STRCMP("mimalloc_reserve_os_memory", name) == 0) {
+    ret = mi_getenv("zoox_alloc_size", result, result_size);
+  } else
+  // Override mimalloc_limit_os_alloc only if zoox_alloc_size is set.
+  if (MI_STRCMP("mimalloc_limit_os_alloc", name) == 0) {
+    if (mi_getenv("zoox_alloc_size", result, result_size)) {
+      // Override with value of "1".
+      mi_strlcpy(result, "1", result_size);
+      ret = true;
+    }
+  } else
+  // Override mimalloc_verbose to enable verbosity only if zoox_alloc_size is set.
+  if (MI_STRCMP("mimalloc_verbose", name) == 0) {
+    if (mi_getenv("zoox_alloc_size", result, result_size)) {
+      mi_strlcpy(result, "1", result_size);
+      ret = true;
+    }
+  } else
+  // Override mimalloc_show_stats to write stats on process exit only if zoox_alloc_size is set.
+  if (MI_STRCMP("mimalloc_show_stats", name) == 0) {
+    if (mi_getenv("zoox_alloc_size", result, result_size)) {
+      mi_strlcpy(result, "1", result_size);
+      ret = true;
+    }
+  } else
+  // Override mimalloc_show_errors to write errors to console.
+  if (MI_STRCMP("mimalloc_show_errors", name) == 0) {
+    mi_strlcpy(result, "1", result_size);
+    ret = true;
+  } else
+  // Override mimalloc_eager_commit_delay to disable it.
+  // See: https://github.com/microsoft/mimalloc/issues/293
+  if (MI_STRCMP("mimalloc_eager_commit_delay", name) == 0) {
+    mi_strlcpy(result, "0", result_size);
+    ret = true;
+  } else
+  // Override mimalloc_allow_decommit to disable it. For static allocation
+  // we don't want to release memory back to OS.
+  if (MI_STRCMP("mimalloc_allow_decommit", name) == 0) {
+    mi_strlcpy(result, "0", result_size);
+    ret = true;
+  } else {
+    ret = mi_getenv(name, result, result_size);
+  }
+  return ret;
+}
+
 static void mi_option_init(mi_option_desc_t* desc) {  
   // Read option value from the environment
   char buf[64+1];
   mi_strlcpy(buf, "mimalloc_", sizeof(buf));
   mi_strlcat(buf, desc->name, sizeof(buf));
   char s[64+1];
-  if (mi_getenv(buf, s, sizeof(s))) {
+  if (zoox_getenv(buf, s, sizeof(s))) {
     size_t len = strlen(s);
     if (len >= sizeof(buf)) len = sizeof(buf) - 1;
     for (size_t i = 0; i < len; i++) {
diff -urZ --new-file mimalloc-ad058291953dbe00d7a7d7f786d17f7f4c563033/src/os.c mimalloc-zoox/src/os.c
--- mimalloc-ad058291953dbe00d7a7d7f786d17f7f4c563033/src/os.c	2020-11-06 17:49:10.000000000 -0800
+++ mimalloc-zoox/src/os.c	2020-12-01 09:51:04.365190332 -0800
@@ -326,6 +326,18 @@
 #else
 #define MI_OS_USE_MMAP
 static void* mi_unix_mmapx(void* addr, size_t size, size_t try_alignment, int protect_flags, int flags, int fd) {
+  // ZOOX(rrishel):
+  // Before first mmap we invoke mlockall.
+  static _Atomic(int) mlockall_init = ATOMIC_VAR_INIT(0);
+  if (!mi_atomic_load_relaxed(&mlockall_init)) {
+    // Only attempt to mlockall if we have memory to lock.
+    if (mi_option_is_enabled(mi_option_reserve_os_memory)) {
+      // TODO(rrishel) Fail hard to let user know locking didn't work. This is likely due
+      // to `memlock` limit set too low.
+      mlockall(MCL_CURRENT | MCL_FUTURE);
+    }
+    mi_atomic_store_release(&mlockall_init, 1);
+  }
   void* p = NULL;
   #if (MI_INTPTR_SIZE >= 8) && !defined(MAP_ALIGNED)
   // on 64-bit systems, use the virtual address area after 4TiB for 4MiB aligned allocations
diff -urZ --new-file mimalloc-ad058291953dbe00d7a7d7f786d17f7f4c563033/src/segment.c mimalloc-zoox/src/segment.c
--- mimalloc-ad058291953dbe00d7a7d7f786d17f7f4c563033/src/segment.c	2020-11-06 17:49:10.000000000 -0800
+++ mimalloc-zoox/src/segment.c	2020-12-01 09:51:04.365190332 -0800
@@ -246,10 +246,10 @@
   if (MI_SECURE>0) {
     // _mi_os_unprotect(segment, mi_segment_size(segment)); // ensure no more guard pages are set
     // unprotect the guard pages; we cannot just unprotect the whole segment size as part may be decommitted
-    size_t os_pagesize = _mi_os_page_size();
-    _mi_os_unprotect((uint8_t*)segment + mi_segment_info_size(segment) - os_pagesize, os_pagesize);
-    uint8_t* end = (uint8_t*)segment + mi_segment_size(segment) - os_pagesize;
-    _mi_os_unprotect(end, os_pagesize);
+    size_t os_page_size = _mi_os_page_size();
+    _mi_os_unprotect((uint8_t*)segment + mi_segment_info_size(segment) - os_page_size, os_page_size);
+    uint8_t* end = (uint8_t*)segment + mi_segment_size(segment) - os_page_size;
+    _mi_os_unprotect(end, os_page_size);
   }
 
   // purge delayed decommits now? (no, leave it to the cache)
@@ -712,12 +712,12 @@
   if (MI_SECURE>0) {
     // in secure mode, we set up a protected page in between the segment info
     // and the page data
-    size_t os_pagesize = _mi_os_page_size();    
-    mi_assert_internal(mi_segment_info_size(segment) - os_pagesize >= pre_size);
-    _mi_os_protect((uint8_t*)segment + mi_segment_info_size(segment) - os_pagesize, os_pagesize);
-    uint8_t* end = (uint8_t*)segment + mi_segment_size(segment) - os_pagesize;
-    mi_segment_ensure_committed(segment, end, os_pagesize, tld->stats);
-    _mi_os_protect(end, os_pagesize);
+    size_t os_page_size = _mi_os_page_size();    
+    mi_assert_internal(mi_segment_info_size(segment) - os_page_size >= pre_size);
+    _mi_os_protect((uint8_t*)segment + mi_segment_info_size(segment) - os_page_size, os_page_size);
+    uint8_t* end = (uint8_t*)segment + mi_segment_size(segment) - os_page_size;
+    mi_segment_ensure_committed(segment, end, os_page_size, tld->stats);
+    _mi_os_protect(end, os_page_size);
     if (slice_entries == segment_slices) segment->slice_entries--; // don't use the last slice :-(
     guard_slices = 1;
   }
diff -urZ --new-file mimalloc-ad058291953dbe00d7a7d7f786d17f7f4c563033/src/static.cpp mimalloc-zoox/src/static.cpp
--- mimalloc-ad058291953dbe00d7a7d7f786d17f7f4c563033/src/static.cpp	1969-12-31 16:00:00.000000000 -0800
+++ mimalloc-zoox/src/static.cpp	2020-12-01 09:51:04.365190332 -0800
@@ -0,0 +1 @@
+#include "static.c"
