phalcon/cphalcon — pull request #1987 by sjinks (2014-02-07 08:44:38+00:00)
Title: Preallocate global memory frames in advance

Currently Phalcon preallocates one global memory frame that persists across requests. This PR changes this behavior by preallocating 10 memory frames (in one chunk). This results in fewer memory allocations during request processing.

**Valgrind stats** (`USE_ZEND_ALLOC=0 valgrind $(phpenv which php) /usr/bin/phpunit -c unit-tests/phpunit.xml`)
* **before:** total heap usage: 7,551,361 allocs, 7,547,627 frees, 869,478,218 bytes allocated
* **after:** total heap usage: 7,453,755 allocs, 7,450,068 frees, 859,840,913 bytes allocated

97.5k less memory allocations (this is not the cheapest operation), 9.1 MiB reused.