|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81419 A memory leak in accel_preload()
Submitted: 2021-09-06 08:23 UTC Modified: 2023-09-28 21:18 UTC
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dinghao dot liu at zju dot edu dot cn Assigned:
Status: Not a bug Package: opcache
PHP Version: 8.0.10 OS: Any
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: dinghao dot liu at zju dot edu dot cn
New email:
PHP Version: OS:


 [2021-09-06 08:23 UTC] dinghao dot liu at zju dot edu dot cn
There is a suspected memleak issue in ext/opcache/ZendAccelerator.c. In function accel_preload(), variable 'preload_scripts' is allocated at line 4453 through emalloc(). All paths after this allocation will execute the cleanup against this variable at 'finish' label, except for one error handling path on failure of preload_optimize() at line 4687, which may cause a memleak.

This bug is suggested by a static analysis tool, please advise.


fix_memleak.patch (last revision 2021-09-06 08:23 UTC by dinghao dot liu at zju dot edu dot cn)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-09-16 21:32 UTC]
-Package: *Extensibility Functions +Package: opcache
 [2021-10-15 15:20 UTC]
-Status: Open +Status: Feedback
 [2021-10-15 15:20 UTC]
Can you provide a proper .php test case?
 [2021-10-17 12:38 UTC] dinghao dot liu at zju dot edu dot cn
-Status: Feedback +Status: Open
 [2021-10-17 12:38 UTC] dinghao dot liu at zju dot edu dot cn
Sorry, currently I have no PoC for this bug.
The memleak is mainly analyzed theoretically.
 [2023-01-18 05:25 UTC] Mae565Law at gmail dot com
The consequences of memory leak is that it reduces the performance of the computer by reducing the amount of available memory. Eventually, in the worst case, too much of the available memory may become allocated and all or part of the system or device stops working correctly, the application fails, or the system slows down vastly .

 [2023-01-27 23:47 UTC] dossche dot niels at gmail dot com
I don't think this qualifies as a bug: the failure path of preload_optimize will call zend_accel_error_noreturn and that function stops execution of the php process, that's why there is no cleanup handling.
 [2023-09-28 21:18 UTC]
-Status: Open +Status: Not a bug
 [2023-09-28 21:18 UTC]
Closing as invalid as per my previous comment.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC