W3C home > Mailing lists > Public > public-webapps@w3.org > January to March 2012

Re: File API "oneTimeOnly" is too poorly defined

From: Glenn Maynard <glenn@zewt.org>
Date: Fri, 30 Mar 2012 14:55:25 -0500
Message-ID: <CABirCh966T1ysfuKyrsrzgcqwM9Oo0Xp6+BnEu=VPqbWRNv-jQ@mail.gmail.com>
To: Bronislav Klučka <Bronislav.Klucka@bauglir.com>
Cc: public-webapps@w3.org
2012/3/30 Bronislav Klučka <Bronislav.Klucka@bauglir.com>

> url = createObjectURL(blob);
>> blob = null;
>> setTimeout(function() { img.src = url; }, 0);
>>
>  That should not be problematic; yes, GC may actually free that blob
> allocated memory later than that timeout function triggers, but there is
> explicit release of that blob (blob = null), so this must fail (memory
> might be allocated by blob data, but that variable should be out). But
> following may cause the same issue
>

"blob = null" is not an explicit release of anything.  It's just clearing a
reference.  The only way to know that the blob is no longer referenced is
to wait for GC--that's what garbage collection *is*.  It's impossible to
guarantee that the "img.src = url" above will fail (without placing severe
constraints on how GC can be implemented, which won't happen).

-- 
Glenn Maynard
Received on Friday, 30 March 2012 19:55:57 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:50 GMT