Skip to content

Conversation

jedi-pl
Copy link
Contributor

@jedi-pl jedi-pl commented Dec 8, 2014

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 value 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

@@ -26,7 +26,7 @@

/* Generated on an Octa-ALPHA 300MHz CPU & 2.5GB RAM monster */
static uint prime_numbers[] =
{5, 11, 19, 53, 107, 223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987, 262237, 524521, 1048793 };
{5, 11, 19, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, 1610612741 };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the need to change the existing numbers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need at all, it was seperate commit. I didn't know that it will be in the same pull request, sorry

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jedi-pl You should make separate branches for your pull requests, it's quite easy to do.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jedi-pl To avoid the unnecessary revert commit, I suggest you use git reset to remove them.

@smalyshev smalyshev added the Bug label Dec 8, 2014
@php-pulls php-pulls merged commit bdb2d49 into php:master Feb 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants