[issue24172] Errors in resource.getpagesize module documentation
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
New submission from Mahmoud Hashemi: The resource module's description of resource.getpagesize is woefully misguiding. Reproduced in full for convenience: resource.getpagesize() Returns the number of bytes in a system page. (This need not be the same as the hardware page size.) This function is useful for determining the number of bytes of memory a process is using. The third element of the tuple returned by getrusage() describes memory usage in pages; multiplying by page size produces number of bytes. Besides being vague by not referring to the third element as ru_maxrss, the peak RSS for the process (i.e., not the current memory usage), tests on Linux, Darwin, and FreeBSD show the following: * Linux: ru_maxrss is in kilobytes * Darwin (OS X): ru_maxrss is in bytes * FreeBSD: ru_maxrss is in kilobytes (same as Linux) Knowing the page size is probably useful to someone, but the misinformation has definitely sent more than one person down the wrong path here. Additionally, the correct information should be up in the getrusage() method documentation, closer to relevant field descriptions. Mahmoud ---------- assignee: docs@python components: Documentation messages: 243043 nosy: docs@python, mahmoud priority: normal severity: normal status: open title: Errors in resource.getpagesize module documentation versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24172> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
R. David Murray added the comment: Indeed, we should probably be referring people to their system's man pages for the authoritative definition of most of these fields. According to the man pages project getpagesize is no longer a POSIX API, and that should probably be noted as well (ie: it isn't present on all systems, and furthermore it is isn't accurate on all systems where it is present...apparently older GCCs got it wrong). ---------- nosy: +r.david.murray _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24172> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Changes by R. David Murray <rdmurray@bitdance.com>: ---------- stage: -> needs patch versions: -Python 3.2, Python 3.3, Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24172> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
John Runyon added the comment: This is a duplicate of 20468, which has a patch submitted (over a year ago). ---------- nosy: +jrunyon _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24172> _______________________________________
![](https://secure.gravatar.com/avatar/fa0f7819f1825f596b384c19aa7dcf33.jpg?s=120&d=mm&r=g)
Martin Panter added the comment: The documentation already says to consult the getrusage(2) man page. Regarding the getpagesize() API, Python’s implementation actually falls back to Posix’s sysconf(). Perhaps it should prefer sysconf() over getpagesize(), but that would be a separate issue. Anyway I will commit the important half of the Issue 20468’s patch, so I think we can close this. ---------- nosy: +martin.panter resolution: -> duplicate stage: needs patch -> resolved status: open -> closed superseder: -> resource module documentation is incorrect versions: +Python 3.6 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue24172> _______________________________________
participants (4)
-
John Runyon
-
Mahmoud Hashemi
-
Martin Panter
-
R. David Murray