Avoiding OOM for armv7 ports on arm64
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 25 Oct 2023 00:31:34 UTC
Greetings, One thing that bugged me for quite a while is that armv7 tasks on arm64 hosts (common case for cross-building ports) can seemingly only allocate 2 GB of memory despite having access to a full 32 bit virtual address space, which should give 4 GB of memory to play around with. This causes many ports to fail due to address space exhaustion in LLVM and rustc. Debugging this with kib, we found that poor default and lack of kernel code are to blame (PR #274705). A workaround can be applied to select roughly the same defaults as used for i386 tasks on amd64: To /etc/sysctl.conf, add kern.maxssiz=67108864 kern.maxdsiz=536870912 to restrict the stack reservation to 64M. This also affects 64 bit processes, but I don't think anybody needs more stack than that. Data is restricted to 512M, which doesn't really matter for 64 bit as we do not support sbrk on arm64. Then reboot, or apply these limits with the sysctl utility. Hope this helps! Yours, Robert Clausecker -- () ascii ribbon campaign - for an 8-bit clean world /\ - against html email - against proprietary attachments