| 1 | initial version |
You're using get_memory_usage incorrectly -- it returns the amount of memory used at a given point in time. If you pass in a number to it, then it will return the difference between the current memory usage and the number you passed in. For example,
sage: get_memory_usage()
875.8515625
sage: t = get_memory_usage()
sage: get_memory_usage(t)
0.0
So, in your usage, it's just subtracting toy(1000) from the current memory usage.
If you're interested in doing more "in-depth" memory profiling than what get_memory_usage can offer, you should look into heapy.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.