Edit report at https://bugs.php.net/bug.php?id=80108&edit=1
ID: 80108
Updated by: [email protected]
Reported by: gilperon at gmail dot com
Summary: APACHE+PHP not releasing memory in certain
conditions on Win10
Status: Re-Opened
-Type: Bug
+Type: Documentation Problem
Package: *General Issues
Operating System: *
PHP Version: 7.4.10
Block user comment: N
Private report: N
New Comment:
> Anyway I can force that?
You can call gc_mem_caches() in an auto_prepend_file.
Changing to doc problem.
Previous Comments:
------------------------------------------------------------------------
[2020-09-17 00:19:51] gilperon at gmail dot com
@[email protected] It also would be nice if at least Zend was smart enough to clear the cache everytime a request is terminated/finished. Anyway I can force that?
------------------------------------------------------------------------
[2020-09-16 23:59:01] gilperon at gmail dot com
@nikic I tried what you said and it WORKED PERFECTLY!!! Literally perfectly. Right after executing "gc_mem_caches" the RAM usage drops to the normal 5-6MB!
Pretty awesome! So I think I will have to throw `gc_mem_caches()` all over my codes so it does not trash the RAM! Maybe you know some way I can tell PHP to better optimize the RAM usage? Something like: "hey PHP, if your Zend cache is over 500MB, please clear it." ?
------------------------------------------------------------------------
[2020-09-16 20:20:44] [email protected]
Try gc_mem_caches().
------------------------------------------------------------------------
[2020-09-16 20:18:35] gilperon at gmail dot com
Someone told me at SO to use:
gc_enable();
gc_collect_cycles();
However, even after using it, no memory is released. So how do I force Zend to release the cache/memory?
------------------------------------------------------------------------
[2020-09-16 13:44:46] gilperon at gmail dot com
Wow, by the votes, some other people reported the same issue! Great, hope some responsible non-sarcastic voluntary of PHP project can fix this. As I said, I know how memory management/leak work, but I have 0 idea how PHP source code was implemented. It would take me months to study PHP code only to fix this bug, so yeah, better hope that some good responsible person, that already knows inner workings of PHP, decide to fix this, or at least take a close look instead of just saying "this is expected behaviour, deal with it".
@[email protected] this is not expected, mainly if you have a server that gets thousands of requests like this. It will trash the RAM in seconds.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=80108
--
Edit this bug report at https://bugs.php.net/bug.php?id=80108&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.