mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 01:36:27 +00:00
Decrease memory usage
This commit is contained in:
@@ -455,7 +455,7 @@ def buildEPUB(path, chapterNames, tomeNumber):
|
||||
|
||||
def imgDirectoryProcessing(path):
|
||||
global workerPool, workerOutput
|
||||
workerPool = Pool()
|
||||
workerPool = Pool(maxtasksperchild=100)
|
||||
workerOutput = []
|
||||
options.imgMetadata = {}
|
||||
options.imgOld = []
|
||||
@@ -1185,9 +1185,11 @@ def makeMOBI(work, qtGUI=None):
|
||||
threadNumber = 1
|
||||
elif 2 < availableMemory <= 4:
|
||||
threadNumber = 2
|
||||
else:
|
||||
elif 4 < availableMemory <= 8:
|
||||
threadNumber = 4
|
||||
makeMOBIWorkerPool = Pool(threadNumber)
|
||||
else:
|
||||
threadNumber = None
|
||||
makeMOBIWorkerPool = Pool(threadNumber, maxtasksperchild=10)
|
||||
for i in work:
|
||||
makeMOBIWorkerPool.apply_async(func=makeMOBIWorker, args=(i, ), callback=makeMOBIWorkerTick)
|
||||
makeMOBIWorkerPool.close()
|
||||
|
||||
@@ -238,13 +238,13 @@ def main(argv=None, qtGUI=None):
|
||||
work = []
|
||||
pagenumber = 1
|
||||
splitWorkerOutput = []
|
||||
splitWorkerPool = Pool()
|
||||
splitWorkerPool = Pool(maxtasksperchild=10)
|
||||
if options.merge:
|
||||
print("Merging images...")
|
||||
directoryNumer = 1
|
||||
mergeWork = []
|
||||
mergeWorkerOutput = []
|
||||
mergeWorkerPool = Pool()
|
||||
mergeWorkerPool = Pool(maxtasksperchild=10)
|
||||
mergeWork.append([options.targetDir])
|
||||
for root, dirs, files in os.walk(options.targetDir, False):
|
||||
dirs, files = walkSort(dirs, files)
|
||||
|
||||
Reference in New Issue
Block a user