Low priority: creating a new pilot leaks about 1 KB
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 58/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- game-dev, performance
Línea de trabajo
Start at init_new_pilot and pilot_set_start_campaign in managepilot.cpp, then inspect cutscene_init and parse_cutscene_table in cutscenes.cpp for ownership and cleanup behavior. Check the file-list ownership returned by cf_get_file_list in cfilesystem.cpp. Build with the issue's AddressSanitizer and leak-check flags, create a new pilot, and verify that LeakSanitizer reports no creation-related leaks.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Low priority. A small, one-time leak per new pilot (about 1 KB). It would take a very large number of pilot creations in one session to matter; filing it so it's on record.
Problem
Creating a new pilot leaks a little memory each time:
init_new_pilotcallscutscene_init()again (managepilot.cpp:159), which clearsCutsceneswithout freeing each entry'sdescriptionand then reloads the table (cutscenes.cpp:212 and 158). Every reload leaks the previous descriptions; it also registerscutscene_closewithatexitagain.pilot_set_start_campaigngets a list of campaign file names fromcf_get_file_listand never frees it (managepilot.cpp:206).
Steps to reproduce
- Build master (12a36dc1a) with
-DGCC_ENABLE_ADDRESS_SANITIZER=ON -DGCC_ENABLE_LEAK_CHECK=ON. - Start with retail data and an empty preferences folder, create a new pilot, reach the main hall, and quit normally.
- Read LeakSanitizer's report.
Expected vs. actual behavior
Expected: no leaks from creating a pilot.
Actual: LeakSanitizer reports 875 bytes in 10 allocations from parse_cutscene_table (cutscenes.cpp:158, via cutscene_init) and 11 bytes from cf_get_file_list (cfilesystem.cpp:2142, via pilot_set_start_campaign).
Proposed fixes
Ranked by simplicity, then maintainability, then thoroughness.
- Call
cutscene_close()at the top ofcutscene_init()before clearing the list, and free the campaign file list at the end ofpilot_set_start_campaign. - Make
cutscene_info::descriptionanSCP_stringso the vector owns it and no manual free is needed, and register theatexitonly once. - Have the pilot code reset only the cutscenes' viewable flags instead of re-running the whole table load, which also saves re-parsing the tables on every new pilot.
- Lenguaje dominante
- C++
- Estrellas
- 488
- Forks
- 184
- Merge medio
- 2 d 8 h
- PR fusionados (30 d)
- 41
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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.
Más de scp-fs2open/fs2open.github.com
-
P2: A timed rotation maneuver does nothing on a ship that had an earlier timed lateral maneuverAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
scp-fs2open/fs2open.github.com#7914 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
scp-fs2open/fs2open.github.com#7901 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
scp-fs2open/fs2open.github.com#7899 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
scp-fs2open/fs2open.github.com#7890 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 43/100
scp-fs2open/fs2open.github.com#7913 ·
Los mantenedores suelen responder en 1 día
Todos los issues de scp-fs2open/fs2open.github.com
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
eclipse-score/inc_someip_gateway#356 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
HarperFast/rocksdb-js#945 ·
Los mantenedores suelen responder en 1 día
-
A failed COMMIT leaves the DuckLake transaction registered, leaking the whole DuckDB instanceAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día