|
From: | Eric Hughes |
Subject: | Re: [Gnash-dev] Garbage collector |
Date: | Fri, 15 Jun 2007 15:45:45 -0600 |
At 02:18 PM 6/15/2007, strk wrote:
var o = new Object; o.hello = function() { trace("hello"); } Function.prototype.constructor = o; delete o; Function.prototype.constructor.helo(); // expect a trace
Two issues: the reference outward from "constructor" and the references toward "o".
First. The reference variable for "constructor" should be able to be hold either a weak or a strong reference, and it would be initialized to a weak reference. This means that in the ordinary case where constructor assignment does not occur, that the incremental RC mechanism will catch it, eliminating an item for the GC to deal with.
Second. After assignment, "constructor" (an l-value) contains a strong reference to the r-value of "o". At this point both the variables "o" and "constructor" have references. Then when the variable "o" itself goes away (an l-value), "constructor" still has a strong reference.
This was the kind of thing I mentioned earlier about possibility and feasibility. To use weak references in this way requires that r-values and l-values be separate, and I'm just not familiar enough with the VM implementation to know if this is already there or, if lacking, what requisite effort would be resolved.
Eric
[Prev in Thread] | Current Thread | [Next in Thread] |