Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

释放内存 Releasing memory #141

Open
xuejianxianzun opened this issue Oct 7, 2021 · 1 comment
Open

释放内存 Releasing memory #141

xuejianxianzun opened this issue Oct 7, 2021 · 1 comment

Comments

@xuejianxianzun
Copy link

使用这个工具转换 gif 之后,内存的使用量增加了,但是迟迟没有得到释放。如果持续转换了多个 gif 图片,内存占用可能会令页面崩溃。
我添加了一处释放内存的代码来修复这个问题:

              image = new Blob([data], { type: 'image/gif' })

              // releasing memory
              this.freeWorkers.forEach(worker => {
                if (worker !== null) {
                  worker.terminate()
                }
              })

              return this.emit('finished', image, data)
@flyskywhy
Copy link

你可以试下这个可以不使用 worker 的 gifenc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants