anthonynsimon / bild

Image processing algorithms in pure Go
MIT License
3.97k stars 213 forks source link

Running bild with WASM #61

Closed nickman closed 5 years ago

nickman commented 6 years ago

Hello;

First off, I would like to say that bild has been a pleasure to develop with. I have been preparing a demo of WebAssembly using Go (basically running Go in the browser via WebAssembly, or GoWasm) and as a proof of concept, we compiled bild to wasm to perform image manipulation in the browser. It has been working fantastically. (browser manipluated image of our mascot below)

This issue is half positive feedback, but also half issue report. In our proof of concept, we load an image and have 12 buttons that invoke 12 different bild image transforms. All of them run without issue and can be run repeatedly.... except for shearh and shearv. We can run those 4 to 5 times and then the heap gets full and we get memory allocation errors. The invocation of shear-x operations are identical in flow as all the other operations, but none of the others exhaust the heap.

From the ugly POC: image

So I was wondering if there was anything special about shear operations that might cause this. Definitely seems like there's a memory leak there.

Thanks again for your great library.

image

anthonynsimon commented 5 years ago

Hi, first of all sorry for taking so long to reply! I think it's super cool that you run bild via WebAssembly, it's not something I had thought of at all.

Before I dive into it, were you able to find the cause for this?

Thanks a lot for the feedback and the detailed issue, I really appreciate it.