[Python-de] Python Memory Limits

Thomas Guettler hv at tbz-pariv.de
Fr Sep 9 08:31:03 CEST 2011


Am 09.09.2011 08:15, schrieb Thomas Lehmann:
> Es gibt viele Möglichkeiten:
> 
> def calculateString():
>     return "".join(map(str,range(10**8)))
> 
> Traceback (most recent call last):
>   File "Dummy.py", line 5, in <module>
>     print(exceedMemory1())
>   File "Dummy.py", line 3, in exceedMemory1
>     return "".join(map(str,range(10**8)))
> MemoryError

Hallo,

unter Linux kannst du dir mit ulimit anzeigen lassen, was
für Beschränkungen bestehen. Vermutlich lässt sich
das auch in Python abfragen.

===> help ulimit
ulimit: ulimit [-SHacdfilmnpqstuvx] [limit]
    Ulimit provides control over the resources available to processes
    started by the shell, on systems that allow such control.  If an
    option is given, it is interpreted as follows:

        -S	use the `soft' resource limit
        -H	use the `hard' resource limit
        -a	all current limits are reported
        -c	the maximum size of core files created
        -d	the maximum size of a process's data segment
        -e	the maximum scheduling priority (`nice')
        -f	the maximum size of files written by the shell and its children
        -i	the maximum number of pending signals
        -l	the maximum size a process may lock into memory
        -m	the maximum resident set size
        -n	the maximum number of open file descriptors
        -p	the pipe buffer size
        -q	the maximum number of bytes in POSIX message queues
        -r	the maximum real-time scheduling priority
        -s	the maximum stack size
        -t	the maximum amount of cpu time in seconds
        -u	the maximum number of user processes
        -v	the size of virtual memory
        -x	the maximum number of file locks



-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de


Mehr Informationen über die Mailingliste python-de