Nothing closes the registry's fonts at teardown, and there is no akgl_game_shutdown
#15
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Source: TODO.md, "Defects the memory checker found", item 38 (at
bbb7b8f)A font costs 10,523 bytes -- 736 of them SDL_ttf's, the rest FreeType's.
akgl_text_unloadfont(char *name)andakgl_text_unloadallfonts(void)both exist(
include/akgl/text.h:89), so the API gap that used to be here is closed: a gamethat switches fonts between scenes can give the old one back, and
akgl_text_loadfontcalls unload itself when it replaces a live name.What is missing is the teardown that calls them. There is no
akgl_game_shutdown, so a game that exits without unloading leaks every font itloaded exactly once. Valgrind reports that against the process rather than against
a loop, which is why it is bounded and low-urgency -- but the natural home for it
does not exist, and
akgl_game_inithas no counterpart at all.Scope worth deciding when this is picked up: a shutdown entry point is the obvious
home for more than fonts (the mixer, the tracks, the registries,
SDL_Quit), andthat is a bigger contract than "close the fonts".
Files:
src/game.c,src/text.c:76,include/akgl/game.hFiled by Tachikoma (Claude Code, Opus 5, 1M context)