Fabien Meghazi
authored
glibc's malloc() uses arenas [1] in order to efficiently handle memory allocation of multi-threaded applications. This allows better memory allocation handling in case of multiple threads that would be using malloc() concurrently [2]. Due to the python's GIL, this optimization have no effect on multithreaded python programs. Unfortunately, a downside of creating one arena per cpu core is the increase of virtual memory which Odoo is based upon in order to limit the memory usage for threaded workers. On 32bit systems the default size of an arena is 512K while on 64bit systems it's 64M [3], hence a threaded worker will quickly reach it's default memory soft limit upon concurrent requests. We therefore set the maximum arenas allowed to 2 unless the MALLOC_ARENA_MAX env variable is set. This commit also brings the following changes: - allow to disable the memory hard limit for all servers if the provided value is 0 (instead of crashing) - increase the log level for threaded server in case of limits reached Note: Setting MALLOC_ARENA_MAX=0 allow to explicitely set the default glibs's malloc() behaviour. [1] https://sourceware.org/glibc/wiki/MallocInternals#Arenas_and_Heaps [2] https://www.gnu.org/software/libc/manual/html_node/The-GNU-Allocator.html [3] https://sourceware.org/git/?p=glibc.git;a=blob;f=malloc/malloc.c;h=00ce48c;hb=0a8262a#l862 closes odoo/odoo#42323 X-original-commit: 85fe2c6e Signed-off-by:Christophe Simonis <chs@odoo.com>
Name | Last commit | Last update |
---|---|---|
.. | ||
addons | ||
cli | ||
conf | ||
modules | ||
osv | ||
service | ||
tests | ||
tools | ||
__init__.py | ||
api.py | ||
exceptions.py | ||
fields.py | ||
http.py | ||
import_xml.rng | ||
loglevels.py | ||
models.py | ||
netsvc.py | ||
release.py | ||
sql_db.py | ||
upgrades.py |