[Python-Dev] Opcode cache in ceval loop (original) (raw)

Victor Stinner victor.stinner at gmail.com
Tue Feb 2 16:32:57 EST 2016


2016-02-02 20:23 GMT+01:00 Yury Selivanov <yselivanov.ml at gmail.com>:

Alright, I modified the code to optimize ALL code objects, and ran unit tests with the above tests excluded:

-- Max process mem (rumaxrss) = 131858432 -- Opcode cache number of objects = 42109 -- Opcode cache total extra mem = 10901106

In my experience, RSS is a coarse measure of the memory usage. I wrote tracemalloc to get a reliable measure of the Python memory usage: https://docs.python.org/dev/library/tracemalloc.html#tracemalloc.get_traced_memory

Run tests with -X tracemalloc -i, and then type in the REPL:

import tracemalloc; print("%.1f kB" % (tracemalloc.gettracedmemory()[1] / 1024.)) 10197.7 kB

I expect this value to be (much) lower than RSS.

Victor



More information about the Python-Dev mailing list