Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

get_memory_usage returning negative integers

Is there a reason that get_memory_usage should ever return a negative number?

I tried running a "toy" program (after get_memory_usage returned surprisingly large numbers on a more complicated program that I'm using in my research - I wanted to see what the standard memory usage should look like for a basic counter function) and here is what happened:

def toy(n):
    c = 0
    for k in xrange(0, n):
        c = c+1
    return c

get_memory_usage(toy(1000))
-464.0859375

I could be misunderstanding how get_memory_usage works, but it seems to me that the memory usage should never be negative!

(In case this is relevant, I am using Sage 4.7.1 on my laptop.)

get_memory_usage returning negative integersnumbers

Is there a reason that get_memory_usage should ever return a negative number?

I tried running a "toy" program (after get_memory_usage returned surprisingly large numbers on a more complicated program that I'm using in my research - I wanted to see what the standard memory usage should look like for a basic counter function) and here is what happened:

def toy(n):
    c = 0
    for k in xrange(0, n):
        c = c+1
    return c

get_memory_usage(toy(1000))
-464.0859375

I could be misunderstanding how get_memory_usage works, but it seems to me that the memory usage should never be negative!

(In case this is relevant, I am using Sage 4.7.1 on my laptop.)