phalcon/cphalcon — pull request #1220 by sjinks (2013-09-12 04:51:08+00:00)
Title: PHALCON_INIT_NVAR(_PNULL) optimization

Replaces calls to

```c
zval_ptr_dtor(&z);
PHALCON_ALLOC_ZVAL(z);
```

with

```c
zval_dtor(z);
ZVAL_NULL(z);
```

when `Z_REFCOUNT_P(z) == 1`.

This:
* makes sure that the new variable will not changes its location in memory (and thus `PHALCON_INIT_NVAR()` can be used after `PHALCON_SEPARATE_PARAM()` — this will make Image code more readable — @dreamszhu, please watch this thread!)
* reduces the number of memory (re)allocations

When manual-unit.php is run under valgrind:
* **before:** 1,994,062 allocs, 1,993,839 frees, 355,849,237 bytes allocated
* **after:** 1,968,935 allocs, 1,968,712 frees, 355,062,535 bytes allocated