[issue42411] respect cgroups limits when trying to allocate memory

Andrew Svetlov report at bugs.python.org
Fri Nov 20 13:35:55 EST 2020


Andrew Svetlov <andrew.svetlov at gmail.com> added the comment:

Could you explain the proposal?

How "+X:UseContainerSupport" behaves for Java? Sorry, I did not use Java for ages and don't follow the modern Java best practices.

>From my understanding, without the Docker the allocation of `bytearray(80 * 1024 * 1024 * 1000)` leads to `raise MemoryError` if there is no such memory available and malloc()/callloc returns NULL.

The exception is typically not handled at all but unwinded to "kill the process" behavior.

The reason for this situation is: in Python when you are trying to handle out-of-memory behavior the handler has a very which chance to allocate a Python object under the hood and raise MemoryError at any line of the Python exception handler.

----------
nosy: +asvetlov

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42411>
_______________________________________


More information about the Python-bugs-list mailing list