Almost crashing computer, was Re: how to solve memory

Peter Otten __peter__ at web.de
Fri Jun 10 10:41:43 EDT 2016


Steven D'Aprano wrote:

> I just ran your code, and it almost crashed my computer. 

When you suspect that a script may consume a lot of memory (the subject 
might have been a hint)

ulimit (bash internal) 

helps you prevent that your linux machine becomes unresponsive.

$ ulimit -v 200000
$ python3 tmp2.py > /dev/null
Traceback (most recent call last):
  File "tmp2.py", line 134, in <module>
    mresult = DFS(b, 2, 2, mylist, path)
  File "tmp2.py", line 125, in DFS
    path = DFS(b, deep-1, maxx, sourceoperators, path)
  File "tmp2.py", line 129, in DFS
    b.append([str(i)+str(j) for i,j in zip(aaa, bbb)])
  File "tmp2.py", line 129, in <listcomp>
    b.append([str(i)+str(j) for i,j in zip(aaa, bbb)])
MemoryError




More information about the Python-list mailing list