Open Mrooze-zeng opened 3 years ago
What is the error that you get in the JavaScript console (developer tools)?
What is the error that you get in the JavaScript console (developer tools)?
There is no error, but the process is getting blocked.
What is the error that you get in the JavaScript console (developer tools)?
Sorry to copy and paste the code with issues, I have corrected it. But when I calculate the MD5 of a file larger than 45MB for the second time without refreshing the page, it is still blocked.
@Mrooze-zeng have you found a solution? Currently experiencing same problem while repeatedly processing large files (~9MB)
I might suggest using a tinygo //export
function to do the MD5 instead of re-buffering. Since the memory is shared, you can use an offset/len pair to update the hasher. I think you can find some WebAssembly hash functions that do similarly even if their source isn't TinyGo. Ex. https://github.com/Daninet/hash-wasm
I am new to Go and want to use wasm to calculate the md5 of a file, but I found that I can only calculate a 45Mb file twice, and then it will be stopped on this line.
dst := make([]byte, args[0].Get("length").Int())
I have to refresh the browser to make it work again. Is the memory usage high or what is the reason? I do not know. Is there a way to release it?I compiled the same code with Go's built-in WASM and it worked well.
My tinygo version:
tinygo version 0.19.0 darwin/amd64 (using go version go1.16.5 and LLVM version 11.0.0)
Here is the my code:
main.go:
index.html:
index.js
build command: