每当我运行我的代码时,我当前都会获得内存。这是导致问题的代码部分。行clear_nodes.append(i +(grid_size * 4))是给出内存错误的那一行,我不确定如何消除它。谢谢
blocked_rows = []
for num in range(grid_size, 2*grid_size):
blocked_rows.append(num)
blocked_rows.append(num+(grid_size*2))
blocked_rows.append(num+2*(grid_size*2))
blocked_rows.append(num+3*(grid_size*2))
blocked_rows.append(num+4*(grid_size*2))
blocked_rows.sort()
clear_nodes = []
for i in blocked_rows:
if i == (grid_size*2)-1:
clear_nodes.append(i)
if i == (grid_size*3):
clear_nodes.append(i)
for i in clear_nodes:
clear_nodes.append(i+(grid_size*4))
#clear_nodes.append(i+(grid_size*8))
for i in clear_nodes:
if i < (grid_size * grid_size):
all_blocked.append(i)