On 2015-04-30, Cecil Westerhof <ce...@decebal.nl> wrote:
> If I execute:
>     l = range(int(1E9)
>
> The python process gobbles up all the memory and is killed. The
> problem is that after this my swap is completely used, because other
> processes have swapped to it. This make those programs more slowly. Is
> there a way to circumvent Python claiming all the memory?
>
> By the way: this is CPython 2.7.8.

It's your operating system's job to handle processes.

If you use xrange() instead of range() then you will get an iterator
which will return each of the numbers in turn without any need to
create an enormous list of all of them.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to