On Jan 8, 2014 5:51 PM, "Keith Winston" <keithw...@gmail.com> wrote:
>
> Well, thanks everyone. I get the picture. And there's nothing subtle
going on here: I'm playing around, trying to factor million-digit numbers
and the like. No biggie, this was interesting.

Million digit numbers will use up some memory. Perhaps a megabyte per
number. If you just hold one in memory and try to factor it then it
shouldn't lead to the problems you described. Or are you holding a list of
many million digit numbers? Or are they several hundred million digits?

The garbage collector has nothing to do with the memory usage of immutable
types like ints. There are deallocated instantly when the last reference
you hold is cleared (in CPython). So if you run out of memory because of
them then it is because you're keeping them alive in your own code. Running
the garbage collector with gc.collect cannot help with that.

Oscar
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to