[Tutor] MemoryError

Danny Yoo dyoo at hashcollision.org
Tue Dec 29 21:00:05 EST 2015


> To be honest this is probably a bit beyond the scope of the tutor
> list which is aimed at questions about the Python language and
> standard library. However I'll make a few observations (and assume
> your logic is OK since you did test it on some smaller data first)


Just to add to Alan's comments:  a MemoryError means that your program
is keeping so many things in memory that it has exhausted this
large-but-limited resource.  Typically, when this happens, a
programmer studies their program to see whether they really do need to
keep all the held values at once.

Perhaps the approach itself is doing more than it needs to do.
Unfortunately, without a deep understanding of the approach you are
taking, we can't say anything concrete about this.  From briefly
picking through:

    https://math.dartmouth.edu/~carlp/PDF/implementation.pdf

it does sound like you *have* to do several clever tricks to make this
work in practice: that paper is all about techniques for making CFRAC
work on real computers.  This does not look trivial.

I don't think this is appropriate for Python-tutor, unfortunately.


More information about the Tutor mailing list