On Thursday, December 5, 2013 11:00:07 AM UTC-8, kcrisman wrote:
>
> I'm not a pickling or memory leak expert, but some of you are.  Earn some 
> Stackoverflow rep.
>
>
> http://stackoverflow.com/questions/20294628/using-pythons-pickle-in-sage-results-in-high-memory-usage
>

Possible answer:
 






  It's probably better to not use python's pickle module directly. cPickle 
is already a bit better, but a lot of pickling in sage assumes protocol 2, 
which (c)Pickle doesn't default to. You can use sage's own wrappers of 
pickle. If I do your example with

sage: open("mylist",'w').write(dumps(L))

and then load it in a fresh session via

sage: L = loads(open("mylist",'r').read())

I observe no problems.

Note that the above interface is not the best one to pickle/unpickle in 
sage to a file. You'd be better off using save/load. I just did it that way 
to stay as close as possible to your example.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to