|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78538 shmop memory leak
Submitted: 2019-09-14 19:19 UTC Modified: 2020-01-03 17:15 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: ptk2003 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: *Extensibility Functions
PHP Version: 7.3.9 OS: Windows only
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: ptk2003 at gmail dot com
New email:
PHP Version: OS:


 [2019-09-14 19:19 UTC] ptk2003 at gmail dot com
shmop_open() with any parametrs add about 4KB apache.
"a", "c" irrelevant

for example this code add 4MegaByte working memory apache:
for($i=0; $i<1000; $i++){
$shmophsw=shmop_open(0x4051, "c", 0777, 65536);

apache 2.4.41 x64
windows 2016 server


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-14 19:49 UTC]
Can you give more indication of why you think this is classified as a memory leak, and not just normal memory usage for that extension?

The code below isn't calling to free the memory, so it's not too surprising some is resident.

Also, 1000 * 65kb would be 65Mb if it was a memory leak. As you say it's only 4 MegaByte that sounds, like it's not leaking, just taking a bit more memory than you might expect.
 [2019-09-14 20:05 UTC] ptk2003 at gmail dot com
4KB memory independent of the size of allocated memory in "c" or "n" open mode

1000 interations $shmophsw=shmop_open(0x4051, "c", 0777, 1);
shmop_close($shmophsw); or shmop_open(0x4051, "c", 0777, 65536); give same result:
httpd.exe increase 4MB working ram.

shmop_delete() not change behaviour
(and how use shmop if delete segment after create?)

$shmophsw=shmop_open(0x4051, "a", 0, 0); give same behaviour: each add 4KB httpd.exe
 [2019-09-15 10:02 UTC]
-Status: Open +Status: Verified -Operating System: windows server 2016 x64 +Operating System: Windows only
 [2019-09-15 10:02 UTC]
This looks like a Windows only issue, and the culprit appears to
be that we're not unmapping the shm->descriptor if it's no longer

[1] <>
 [2019-09-15 11:03 UTC] ptk2003 at gmail dot com
it possible to fix in current or future version?
 [2019-11-25 13:10 UTC]
The following pull request has been associated:

Patch Name: Fix #78538: shmop memory leak
On GitHub:
 [2020-01-03 17:14 UTC]
Automatic comment on behalf of
Log: Fix #78538: shmop memory leak
 [2020-01-03 17:14 UTC]
-Status: Verified +Status: Closed
 [2020-01-03 17:15 UTC]
-Assigned To: +Assigned To: cmb
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 19 14:01:30 2024 UTC