memory usage increasing when using opcache.enable_cli and opcache.file_cache_only
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C
- Estrellas
- 40.4k
- Forks
- 8.2k
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 96
Descripción
Description
The below script using opcache.enable_cli=1 and opcache.file_cache_only=1 causes the PHP memory usage to continue to increase. If I disable file_cache_only, then the memory usage remains constant. I was able to reproduce in PHP 8.1, 8.2, and 7.4.
To reproduce, set-up scripts test.php and test2.php as listed below, create an empty directory /tmp/opcache, and then run:
php \
-n \
-d "zend_extension=opcache" \
-d "opcache.enable_cli=1" \
-d "opcache.file_cache=/tmp/opcache" \
-d "opcache.file_cache_only=1" \
test.php
When I run the above, the value of memory_get_usage() continues to increase. If I remove the line for "opcache.file_cache_only=1", then memory_get_usage() remains constant.
If it doesn't happen the 1st time, then try running it a 2nd time.
Can you please check why the memory usage continues to grow in this scenario?
Thanks for your help.
test.php:
<?php
for ($i = 0; $i < 10000; $i++)
{
echo number_format(memory_get_usage())."\n";
require('test2.php');
}
test2.php:
<?php
return;
PHP Version
PHP 8.1.11
Operating System
AlmaLinux 8
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza ejecutando los scripts proporcionados test.php y test2.php con opcache.enable_cli=1 y opcache.file_cache_only=1, y luego compara memory_get_usage() con file_cache_only deshabilitado. Investiga la ruta de la caché de archivos de PHP opcache involucrada en los requisitos repetidos de test2.php; se considera terminado cuando el crecimiento informado está explicado y la reproducción ya no muestra un aumento de memoria.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- php
- Área
- performance
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100