Re: File API "oneTimeOnly" is too poorly defined

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 UTC