php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68565 Counter for wasted memory in Opcache is only int
Submitted: 2014-12-08 12:01 UTC Modified: 2015-05-15 12:11 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kontakt at adrianslowik dot pl Assigned: cmb (profile)
Status: Closed Package: opcache
PHP Version: 5.5.19 OS: Not relevant / Linux Gentoo
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kontakt at adrianslowik dot pl
New email:
PHP Version: OS:

 

 [2014-12-08 12:01 UTC] kontakt at adrianslowik dot pl
Description:
------------
When I set opcache.memory_consumption to 10240 (10Gb), it is possible to have more than 2Gb of wasted memory.

The Wasted memory variable in code is stored in signed int instead of size_t.

In fact I end up with negative amount of wasted memory and wasted memory percentage, which is less than default 5% for scheduling the reload.

To replicate the problem set the opcache.memory_consumption to high value (3Gb)
Use opcache_compile_file and opcache_invalidate in loop with the same file until wasted memory rises above 2Gb

php.ini settings:

opcache.enable=1
opcache.enable_cli=0
opcache.memory_consumption=10240
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=1048793
opcache.max_wasted_percentage=5
opcache.use_cwd=1
opcache.validate_timestamps=0
opcache.revalidate_freq=2
opcache.revalidate_path=1
opcache.save_comments=1
opcache.load_comments=1
opcache.error_log=/var/log/php-fpm.opcache.log
opcache.log_verbosity_level=1



Patches

wasted_shared_memory_int_to_size_t (last revision 2014-12-08 12:02 UTC by kontakt at adrianslowik dot pl)

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-15 12:11 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2015-05-15 12:11 UTC] cmb@php.net
The PR has been merged into master: <https://github.com/php/php-src/commit/999545258308effa49fde71b7af7fdd991256e3a>. Therefore closing.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 08:01:35 2025 UTC