[Bug 10834] Garbage collection is the wrong level of abstraction

http://www.w3.org/Bugs/Public/show_bug.cgi?id=10834

Jonas Sicking <jonas@sicking.cc> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jonas@sicking.cc

--- Comment #3 from Jonas Sicking <jonas@sicking.cc> 2010-09-29 21:39:51 UTC ---
I largely agree with Philip here.

GC should generally never have observable effect. Consider the example of an
element with a specific owner document (X) and then dropping all other
references to that owner document. If GC caused the ownerDocument value from
changing from X to null, then GC has observable side effects.

It should generally be ok to simply state that GC should have no observable
side effects and that the ownerDocument property refers to the owner document.

For HTML5 I can only think of one exception to this rule. If there are cases
when we are concerned that implementations will miss the fact GCing certain
objects will have side effects, then it makes sense to have a informative note
pointing this out.

For example, consider the following code:

var img = document.createElement('img');
img.src = "/imgs/mypic.jpg";
img.onload = function() {
  alert('hello world');
}
img = null;

In this case it might not be obvious that the implementation must not GC the
img element while it is still loading. GCing the element would have the side
effect that the load handler never executes. Thus simply defining "GC must not
have observable side effects" is technically enough to ensure that the img must
not be GCed. However since this might be easy for implementations to miss, thus
leading to bugs, it could be worth pointing out in the spec.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 29 September 2010 21:39:54 UTC