I have a websocket that sends binary images. My script get those images, convert to base64 and display in a tag.
Something like this:
websocket.onmessage = function(evt) {
var msg = evt.data;
var image = $('.my-image')
image.attr('src', "data:image/jpeg;base64,"+ toBase64(msg))
}
This seems to cause a memory leak in Chrome. After a few minutes, it will be easily using more than 1GB of RAM. In a few hours I get the "Aw, Snap" error.
Looking at the resources tab, I see that all images received are displayed. It doesn't look like they are removed at any moment, even when they aren't displayed anymore.
Is there a workaround to this issue? Maybe a way to force the old images to be removed from memory.