Martin Stjernholm, Roxen IS @ Pike developers forum wrote:
o Noncyclic things are no longer destructed and freed immediately. In particular, it means code like this no longer would work:
void foo() { Thread.MutexKey my_lock = my_mutex->lock(); ... do some work ... // my_lock falls out of scope here when the function exits, so // the lock is released right away.
Why would the actual freeing of memory need to synchronous with the running of the destructors? Ideally I'd expect the destructors to be called just like in C++: whenever the variables go out of scope. The actual freeing of the space to return it to the heap can be delayed until the gc finds it.
This can be solved at the compiler level, without changes in Pike applications. It also then supports the level of least surprise, which is always a good thing.
This would immediately get rid of all the dangling filedescriptors everywhere.