On 11/12/10 8:48 PM, Jason Grout wrote:
On 11/12/10 6:22 PM, Maxim wrote:
I get very high memory usage when I do something like:
sage: get_memory_usage()
-> 809.9453125
sage: A=vector(range(0,10000))/1
sage: get_memory_usage()
-> 5393.2734375

Which is a whooping 4.5GB+ of memory to hold a 10000 float vector...

I would have thought more of something along the lines of 24bytes/
float * 10000 floats + some overhead for the vector object ~= 240KB.




The problem seems to stem from the lines

    cdef Element x = X.an_element()
    cdef Element y = Y.an_element()

inside of the detect_element_action function in coerce_actions.pyx.  Notice:

sage: v=vector(range(10000))
sage: get_memory_usage()
206.84765625
sage: w=v.parent().an_element()
sage: get_memory_usage()
3321.14453125

I'm not sure why the coercion system *has* to construct an element, especially if such an element could potentially be expensive to compute and store. And then there's the matter you talk about; why is an element so big?

Thanks,

Jason


--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to