refactor the thumbnail frameworks to resolve memory problem.
for old frameworks, the thumbnail is actually a whole image, and thumbnailing thread can not be cancel. so that it has serious flaws in memory usage. first what i do is to let the image scaled into a smaller size if it is too big. it will ensure that when all thumbnail job finished, the memory usage will not become so scaring. second i do is to use a thumbnail job bounded with a directory item parent, when item deleted it should not do a thumbnail. it will actually limit the Instantaneous peak of memory usage. the main idea is: 1. replace QtConcurrent::run() with a QRunnable, limit thread count with QThreadPool instance. 2. use QObject parent mechanism control the job's running.
parent
babd67d7
Please register or sign in to comment