phalcon/cphalcon — pull request #1009 by sjinks (2013-08-05 16:36:32+00:00)
Title: Diagnostics for developer mode

This patch makes sure that the memory frame is restored by that very function which created it.

If a function tries to restore the frame it did not create, a warning is printed and backtrace is provided.

This ensures the proper frame nesting.

The patch also detects when a MM function/macro (like `PHALCON_INIT_VAR()`) is invoked without calling `PHALCON_MM_GROW()` first.

All checks are performed only when `PHALCON_RELEASE` macro is not defined and therefore the patch affects only developer builds.