mypy daemon consumes an increasing amount of memory every time `run` or `recheck` is invoked
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Python
- Estrellas
- 20.6k
- Forks
- 3.3k
- Métricas de merge de PR
- Métricas de PR pendientes
Descripción
Bug Report
The amount of memory that the daemon process consumes doesn't drop when typing errors are fixed; the memory consumption appears to stay the same if there are no errors, and when more errors appear, the memory consumption just continues increasing.
This is problematic when running the daemon on initially untyped code bases with large amounts of typing errors (as usually done in code editors integrating with a type-checker), as dmypy becomes sluggish very quickly (because the same existing errors are repeatedly reported).
To Reproduce & Actual Behaviour
-
Repeat this line 2000 times in a file
project/test/__init__.py,aaaaaaaaaaaaaaaaaaaaaaaaand create the following mypy configuration file at
project/mypy.ini[mypy] files = test/ -
Navigate to
project/, then rundmypy run > errors.txtmultiple times without editingproject/test/__init__.py; watch the memory consumption grow for thedmypyprocess. -
Delete all code in
project/test/__init__.py, then rundmypy runagain multiple times. The memory consumption does not decrease.
Expected Behavior
I expect the memory consumption to be proportional to the number of errors, AST nodes, and size of a cache diff since the last time the checked code files have changed. If there's no code changes, it's surprising to me that memory consumption would grow for just repeated reports of the same errors.
Your Environment
- Mypy version used: 1.17.1
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini(and other config files): See# project/mypy.ini - Operating system: Ubuntu (Pop!_OS) 22.04 LTS
- Python version used: 3.11
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
Reproduce el problema de project/test/init.py usando project/mypy.ini; después ejecuta dmypy run y repite recheck mientras observas la memoria del daemon. Compara el comportamiento una vez eliminados los errores repetidos; se considera terminado cuando la memoria deja de crecer debido a informes repetidos y disminuye al eliminar errores y nodos AST, con cobertura de regresión para el escenario.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- tooling
- 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