|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77900 Memcache session handling, zend_mm_heap corrupted
Submitted: 2019-04-15 14:35 UTC Modified: 2021-03-25 16:41 UTC
Avg. Score:4.6 ± 0.5
Reproduced:8 of 8 (100.0%)
Same Version:5 (62.5%)
Same OS:2 (25.0%)
From: bb0072 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 7.3.4 OS: Ubuntu 18.04.2 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: bb0072 at gmail dot com
New email:
PHP Version: OS:


 [2019-04-15 14:35 UTC] bb0072 at gmail dot com
When I try to use sessions in my script (php 7.3) with session.save_handler=memcache, I get the following error message: zend_mm_heap corrupted.
Same script on same server does work with php 5.6.

I use the php-memcache extension (not php-memcached!)

Software versions (the most recent stable versions from the Ubuntu 18.04 repo, and php versions from here: bionic main):

 * php7.3-cli (
 * php-memcache (
 * memcached (1.5.6-0ubuntu1 )

Memcache.ini settings (/etc/php/7.3/mods-available/memcache.ini)

Test script:
ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', 'tcp://localhost:11211');

Expected result:
array(1) {

Actual result:
zend_mm_heap corrupted


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-06 21:00 UTC]
I linked to this in

The original bug report was for 3.0.9, but I assume there were significant refactorings in (released in December 2019).

When I try to run this script in php 7.4.3-dev (NTS DEBUG) with PECL memcache, I see the following memory leak instead (low severity because it uses erealloc(), which is freed after each HTTP response on a web server):

ยป php --no-php-ini --php-ini test.ini test.php
array(1) {                                     
[Fri Mar  6 15:40:14 2020]  Script:  '/path/to/test.php'
/tmp/pear/temp/memcache/php7/memcache_queue.c(35) :  Freeing 0x00007f0542e7d700 (208 bytes), script=/path/to/test.php
Last leak repeated 3 times
=== Total 4 memory leaks detected ===

Does anyone see other cases causing zend_mm_heap_corrupted with Memcache sessions in
 [2020-10-05 10:42 UTC] jochem dot blok at fasterforward dot nl
I can reproduce this problem on PHP 7.4 with Ubuntu 20.04. Any progress on this issue?
 [2020-10-05 12:03 UTC] jochem dot blok at fasterforward dot nl
Updating the package to version seems to resolve the issue. I made a bug report for the outdated version of the php-memcache package in Ubuntu 20.04. See
 [2021-03-25 16:41 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-25 16:41 UTC]
The official bug tracker for PECL/memcache is now at

So, if this is still an issue with either of the current memcache
versions (4 or 8), please file an issue there.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu May 06 02:01:23 2021 UTC