This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: module 'resource' has no attribute 'RLIMIT_VMEM'
Type: behavior Stage: resolved
Components: Versions: Python 3.8
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Titusz Ban, andrei.avk, ronaldoussoren
Priority: normal Keywords:

Created on 2020-05-25 18:09 by Titusz Ban, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg369902 - (view) Author: Titusz Ban (Titusz Ban) Date: 2020-05-25 18:09
While trying to limit the virtual memory used by a process, using

import resource
MAX_VIRTUAL_MEMORY = 1 * 1024 * 1024
resource.setrlimit(resource.RLIMIT_VMEM, (MAX_VIRTUAL_MEMORY, MAX_VIRTUAL_MEMORY))

The following error occurred:

AttributeError: module 'resource' has no attribute 'RLIMIT_VMEM'

This is on Ubuntu 16.04 running inside WSL. on Python 3.8.2.
msg400297 - (view) Author: Andrei Kulakov (andrei.avk) * (Python triager) Date: 2021-08-25 21:30
The docs for resource module state:

This module does not attempt to mask platform differences — symbols not defined for a platform will not be available from this module on that platform.

Therefore I think this can be closed.
msg400298 - (view) Author: Andrei Kulakov (andrei.avk) * (Python triager) Date: 2021-08-25 21:34
Also note that according to https://edwards.sdsu.edu/research/memory-and-core-usage-on-sge/,

Linux systems use RLIMIT_AS instead of RLMIMIT_VMEM.

My system (MacOS), also has RLIMIT_AS defined but not RLIMIT_VMEM.
msg400352 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2021-08-26 14:52
According to https://man7.org/linux/man-pages/man2/getrlimit.2.html there is no RLIMIT_VMEM on linux, RLIMIT_AS is the closest equivalent.
History
Date User Action Args
2022-04-11 14:59:31adminsetgithub: 84949
2021-08-26 14:52:28ronaldoussorensetstatus: open -> closed

nosy: + ronaldoussoren
messages: + msg400352

resolution: not a bug
stage: resolved
2021-08-25 21:34:59andrei.avksetmessages: + msg400298
2021-08-25 21:30:38andrei.avksettype: crash -> behavior

messages: + msg400297
nosy: + andrei.avk
2020-05-25 18:09:07Titusz Bancreate