Closed fr0gs closed 8 years ago
I haven't tested but my feeling is that rerender
may be the problem here. My thought is that you are using rerender
to possibly reset the file input and if that is the case, instead, create a new input each time as this should ensure that it is cleared. If that isn't the case then let me know.
Unfortunately not. The memory increase happens before the rerender(). Even when removing the rerendering memory increase still takes place. Moreover, it can't be a file input reset issue because I've tried to perform a combination of inputs such as several taken from Documents, Camcorder, or alternating. Memory increases/decreases behave as expected, but for pictures taken from the Camera an additional save seems to be issued before the observer fires, hence out of control from outside the library. I work on a storage critical mobile web application and I run out of space quite fast when hundreds of pictures are taken.
I have been testing the uploads in a barebone ember application and seems that the
<input id="file" type="file" accept="image//*" capture="camera">
of HTML5 itself behaves this way.
In a completely fresh app that shows nothing but a template and a little logic, I get the same results. (simplified gist)
https://gist.github.com/fr0gs/b9496463d37f509ae03e65bcff65084d
Apparently the camera itself saves directly data in the browser.
Ok so this is a browser issue then?
Seems to be, I found no issue in ember-uploader itself whatsoever.
https://stackoverflow.com/questions/36890184/chrome-html5-file-input-type-memory-leak-ember-js
I came to narrow it down to this piece of code:
https://gist.github.com/fr0gs/080c484931c778fcb22b661a9b000e95
When I upload images from Documents or I take a video from the Camcorder I see chrome's Data memory in android settings not to increase until I afterwards save them via the Local Storage API. However, when I take a picture from the Camera and I place breakpoint even before sending the action the Data memory already has increased the size of the picture uploaded. Subsequently the image is saved via Local Storage API and then removed, but that spurious added memory is never released from Data memory and it eventually leads to full storage.
Just in case my chrome version is 50.0.2661.86 (Official Build) (64-bit) but it seems the library adds the file chrome's Local Storage even before doing it manually.