栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python processpoolexector 释放内存_python进程池内存一直上涨?

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python processpoolexector 释放内存_python进程池内存一直上涨?

import os
import json
from multiprocessing import Pool
from contextlib import closing





def tick(filename, i_):
    try:
        print(i_)
        #s = get_one_note_list(filename)
        #s = get_one_note_list_s(s)
        #with open("D:/MIDI_json/a_{}.json".format(i_), "w", encoding="utf-8") as f:
            #json.dump({"data": s}, f)

    except Exception as e:
        pass
        # print("c{}".format(e),"D:/MIDI_json/a_{}.json".format(i_))



if __name__ == '__main__':
    # 只要这里你定义不同的scheduler就建立了多个调度器
    p = Pool(10)
    with closing(p) as P:

        list1 = []

        for i_, i in enumerate(midi_list[40896:60000]):
            i_ += 40896
            print(i_)

            res = p.apply_async(tick, [i, i_, ])

            list1.append(res)

        P.close()

        P.join()

        print('进程池创建的进程已结束')

        # for j in list1:
        #     print(j.get())

        P.close()

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/786852.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号