How do I find the memory used by a python process
Scott David Daniels
Scott.Daniels at Acm.Org
Mon Nov 3 19:16:36 EST 2008
Ben Finney wrote:
> Salim Fadhley <salimfadhley at gmail.com> writes:
>
>> The unit-test needs to check that after the functions have been run
>> a few thousand times all of the memory used by those functions has
>> been un-allocated, i.e. that there are no memory leaks.
>
> This is a great test case, .... However, I wonder why you specify
> the need to run the function *thousands* of times to test whether
> it releases memory. Surely your code unit is deterministic and will
> release memory (or not) the same way with the same inputs each time?
>
Because simply using small integers will cause them to exist and live
on in a cache. For this (and similar caching reasons), what you want
to see is that memory doesn't grow in an unbounded way.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list