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: getrusage returns platform-dependent value
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.7, Python 3.6, Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: sam-s
Priority: normal Keywords:

Created on 2017-05-30 17:01 by sam-s, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg294768 - (view) Author: sds (sam-s) Date: 2017-05-30 17:01
`resource.getrusage(resource.RUSAGE_SELF).ru_maxrss` returns the peak memory usage, in *bytes* on BSD (including Mac OS X) and in *kilobytes* on Linux.

This means that to get a cross-platform value, the user has to check `sys.platform`, which is fairly inconvenient.

It would seem like a good idea to return a platform-independent value (e.g., multiply the Linux return value by 1000 - or is it 1024?!)

Please see also 

* https://bugs.python.org/issue20468
* https://stackoverflow.com/a/7669482/850781

Thank you!
msg294769 - (view) Author: sds (sam-s) Date: 2017-05-30 17:16
Experiment shows that the Linux multiplier is 1024 (not 1000).
History
Date User Action Args
2022-04-11 14:58:47adminsetgithub: 74698
2017-05-30 17:16:22sam-ssetmessages: + msg294769
2017-05-30 17:01:19sam-screate