window.URL.revokeObjectURL() doesn't release memory immediately (or not at all)?

前端 未结 2 1561
误落风尘
误落风尘 2021-02-02 16:28

I\'m making an html interface to upload images on a server with Drag & Drop and multiple selection files. I want to display the pictures before sending them to the server. S

2条回答
  •  甜味超标
    2021-02-02 16:43

    This isn't an answer, but I just want to say that, as far as I can tell, this is still an issue in the latest version of Chrome (35). I made a test page that exposes the problem:

    http://ecobyte.com/tmp/chromecrash-1a.html

    If you select a large number (say, 600) of high resolution photos on your computer and drop them into the box on that page, it will crash Chrome (tried on Windows 7 and Mac OS X 10.8.5).

    If you look at the source you can see that sequence of ops is:

    1. createObjectURL
    2. load the img (don't add to DOM!)
    3. revokeObjectURL to free the ref
    4. Lose the img ref
    5. Repeat all steps for next dropped image

    Seems like only a single image should be in memory/referenced at any given moment, but eventually this crashes Chrome.

提交回复
热议问题