Python 2.7 池在python中导致内存错误

Python 2.7 池在python中导致内存错误,python-2.7,memory,multiprocessing,Python 2.7,Memory,Multiprocessing,我已经编写了一个多进程(python 2.7)程序,这是我的主要代码: def pro_func(id): #process a slice of huge csv file and send the output list to #another function list_index=[] for i in range(0,total_shard_cnt,1): list_index.append(i) print(list

我已经编写了一个多进程(python 2.7)程序,这是我的主要代码:

 def pro_func(id):
     #process a slice of huge csv file and send the output list to               
     #another function

 list_index=[]
 for i in range(0,total_shard_cnt,1):
    list_index.append(i)
 print(list_index)
 pool = Pool(processes=total_shard_cnt)
 result = pool.map(pro_func,list_index)
 print(result)
pro_func
是一个由每个进程执行的函数,它将函数的输出列表传递给另一个函数,但当我运行代码时,它会导致Memoryerror,因为:

pro_func的输出是巨大的列表,代码将所有结果保存在ram中,直到完成所有进程,并且在pro_func完成时不会完成一个进程,而是将所有进程一起完成

我如何解决这个问题