Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 1.56 KB

memory-management.md

File metadata and controls

26 lines (22 loc) · 1.56 KB

<-- Return to index

Memory Management

How is memory handled?

PHP

PHP is a managed memory environment, meaning it will automatically allocate and deallocate memory space as necessary without any specific thought necessarily being given by the user.

Python

Likewise, Python is also a managed memory environment. The language environment will manage memory as necessary on its own, and requires no explicit programmatic consideration for day-to-day code.

How does memory management work?

PHP

PHP uses the Zend Memory Manager to act as a go-between for PHP's requests for memory space and the traditional C libraries for asking the operating system for resources.

Python

Python uses the Python Memory Manager to act as a go-between for the language and the OS-level memory allocation layer.

Is there a garbage collection service?

PHP

Yes

Python

Yes, and is directly accessible at the module level.

Is there automatic reference counting?

PHP

Yes. PHP stores the reference count internally in an refcount variable inside a zval container attached to all variables.

Python

Yes, the memory manager will automatically return an objects memory space to the OS-level if its reference count reaches zero.