在 python2.6 中使用大列表(关于使用内存)进行循环的最佳方法是什么

what is best way to for loop with large list(about use memory) in python2.6

这是我的记忆分析结果。

Line #    Mem usage    Increment   Line Contents
================================================
    88 1671.008 MiB    0.012 MiB           self.list_new_log = some_function()
    91 3769.992 MiB 2098.984 MiB           for i in self.list_new_log:
    92 3769.992 MiB    0.000 MiB               ...
                                               ...
                                               ...
   109   15.730 MiB -3754.262 MiB           release_memory(self.list_new_log)

self.list_new_log 是 splitlines() 一些文件。 (巨大的尺寸列表)

我的问题在第 91 行。

for 循环使用大量内存。

我想到了一个方法,把一个巨大的列表分成几个,但似乎不是一个好方法。我该怎么办?

我找到了这个。 http://tiborsimko.org/python-garbage-collection-issue.html 结果,python2 gc 有一些错误。