Ask Your Question

Revision history [back]

click to hide/show revision 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()
sage: t = get_memory_usage()
sage: get_memory_usage(t)

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.