Tag: memory
PHP Generators PHP 5.5+
Functions using yield that produce values lazily — one at a time — instead of building a complete array in memory.
2mo ago
php intermediate
PHP Garbage Collection Internals (Cycle Collector) PHP 5.3+
PHP uses reference counting as its primary memory management strategy — when a value's reference count drops to zero it is freed immediately. A secondary cycle collector handles circular references that reference counting alone cannot free.
2mo ago
php advanced
PHP Memory Model — Zval & Copy-on-Write PHP 7.0+
PHP stores every value in a zval (Zend value) container that holds the type, value, and a reference count. Arrays and strings are copied lazily — the copy only happens when one copy is modified (copy-on-write), making passing large values cheap until mutation.
2mo ago
php advanced
PHP References (&$var) PHP 5.0+
References allow multiple variables to point to the same value — powerful but a frequent source of hard-to-debug side effects.
2mo ago
php intermediate
Python Generators & yield Python 2.2+
Functions that yield values one at a time — enabling lazy evaluation of infinite sequences without storing all values in memory.
2mo ago
python intermediate