Wednesday, November 01, 2006

Weak References

Finally, after a lot of time, we decided and programmed the WeakReference, WeakFunctionObject and WeakCollection objects. We're hoping to improve the performance, now that the application doesn't need to keed track of listeners or anything.

For those of you who wonder how we did it, let me explain:

- Every object registers itself (at creation, and at wakeup times) in a global object table.
- Weak references only keep the position of the referenced object in the table.

This way, when an object has only weak references, php's garbage collector claims it, releasing the memory that's no longer being used.

We are already using it in listeners and observers, and we plan to use it in the page renderer.

Labels:

0 Comments:

Post a Comment

<< Home