09.12.13 03:56, Victor Stinner написав(ла):
On Linux, it's possible to limit globally the "address space" of a
process, but this value is not convinient. For example, the address
space includes shared memory and read-only memory mappings of files,
whereas this memory should not reduce the memory available for other
applications. tracemalloc only counts memory directly allocated by
Python and so private memory which reduces directly the memory
available for other applications.

But tracemalloc doesn't count memory allocated besides Python allocators (e.g. memory for executable, static variables and stack, memory allocated by extensions and C lib, unallocated but not returned to OS dynamical memory). When you want investigate how your program works on low memory, e.g. 500 MB, ulimit -v 500000 is much closer to real life than tracemalloc.

Limiting memory in tracemalloc can be used only for testing obscure corner cases in Python interpreter itself. It will be very rarely used since all bugs will be fixed first time (and thank you for your current work). So there is more sense implemented it as auxiliary utility than as feature of the stdlib module.


_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to