Christian Heimes <li...@cheimes.de> added the comment:

Even if we would decide to add a memory limit based on cgroups, there is no way 
to implement a limit in Python correctly. We rely on the platforms malloc() 
implementation to handle memory allocation for us.

Python has an abstraction layer for memory allocator, but the allocator only 
tracks Python objects and does not keep information about the size of slabs. 
Memory tracking would increase memory usage and decrease performance. It would 
also not track other memory like 3rd party libraries, extension modules, thread 
stacks, and other processes in the same cgroups hierarchy.

I'm pretty sure that the RLIMIT_AS approach will not work if you run multiple 
processes in the same container (e.g. spawn subprocesses).

I'll talk to our glibc and container experts at work next week. Perhaps they 
are aware of a better way to handle cgroups memory limits more gracefully.

----------
components: +Interpreter Core -IO
versions:  -Python 3.6, Python 3.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42411>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to