# New Memory Manager for PHP7

- Thread: https://externals.io/message/76649
- Original archive: https://news-web.php.net/php.internals/76649
- Started by Dmitry Stogov on 2014-08-18T12:04:37+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #76649 — Dmitry Stogov — 2014-08-18T12:04:37+00:00

URL: https://externals.io/message/76649#76649

Hi,

Please take a look into the proposed new Memory Manager for PHP:

https://github.com/php/php-src/pull/777

The patch provides visible performance improvement on real life apps
(tested on Linux 32 and 64 bit). It's based on ideas mainly borrowed from
jemalloc and tcmalloc.

I hope, the patch must implement all the features of previous memory
manager except for "overridable storage", but I might miss something.

It would be great if experienced people could analyze the sources and give
their opinion.

Thanks. Dmitry.

---

## #76666 — Levi Morrison — 2014-08-18T17:59:47+00:00

URL: https://externals.io/message/76649#76666 · In reply to: #76649

> Hi,
>
> Please take a look into the proposed new Memory Manager for PHP:
>
> https://github.com/php/php-src/pull/777

It looks like the gains are mostly earned by passing size information;
is that correct?

---

## #76667 — Nikita Popov — 2014-08-18T18:04:53+00:00

URL: https://externals.io/message/76649#76667 · In reply to: #76666

> 
> > […]
>
> It looks like the gains are mostly earned by passing size information;
> is that correct?
>

Nope, this is an entirely new allocator implementation. GitHub doesn't show
it in the diff because there are too many changes. See the file
https://github.com/dstogov/php-src/blob/xx_malloc/Zend/zend_alloc.c

Nikita

---

## #76668 — Levi Morrison — 2014-08-18T18:07:24+00:00

URL: https://externals.io/message/76649#76668 · In reply to: #76667

> 
> > […]
>
>
> Nope, this is an entirely new allocator implementation. GitHub doesn't show
> it in the diff because there are too many changes. See the file
> https://github.com/dstogov/php-src/blob/xx_malloc/Zend/zend_alloc.c

Ah, I knew it couldn't be that simple. Thanks for pointing out my oversight.

---

## #76796 — Dmitry Stogov — 2014-08-22T10:04:11+00:00

URL: https://externals.io/message/76649#76796 · In reply to: #76668

Hi,

I'm going to commit this on next week, if nobody cares.
MM is a self containing subsystem, and it must not affect anything else.

Thanks. Dmitry.





> On Mon, Aug 18, 2014 at 12:04 PM, Nikita Popov <nikita.ppv@gmail.com>
> wrote:
> > […]
> show
> > […]
>
> Ah, I knew it couldn't be that simple. Thanks for pointing out my
> oversight.

---

## #76819 — Levi Morrison — 2014-08-22T16:17:51+00:00

URL: https://externals.io/message/76649#76819 · In reply to: #76796

> Hi,
>
> I'm going to commit this on next week, if nobody cares.
> MM is a self containing subsystem, and it must not affect anything else.
>
> Thanks. Dmitry.

I compared this to master on a small PHP array vs SplFixedArray
performance test I had lying around. It's a fairly small difference,
but the new memory manager does seem to be consistently faster. No
complaints from me.
