Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
In very trivial cases the compiler can determine that the object doesn't get refs from elsewhere, e.g:
void foo() { Foo x = Foo(); bar (y);
However, if you do just
void foo() { Foo x = Foo(); bar (x);
then the compiler can no longer know if x has grown more references during the bar or beep calls. For that to work, the compiler would
I see. You're right, of course. In that case I'd indeed vote for some kind of micro-gc at the end of every scope which tries to gc all (and just) the locally declared variables which are leaving scope. It would make the invocations of the destructors more predictabe and timely, and might help in rapid allocation/release cycles to keep memory usage within bounds.