Thursday, July 17, 2008

Design Pattern in PHP: Object Pool Pattern

Still working on my AOP framework for PHP, I stumble upon an interesting problem: when there are many files that require weaving, at some point memory usage was spiking very high (north of 256M) . For environments where memory is a scarce resource, I needed object recycling.

Here is what I came up with: