Zval memory management and garbage collection