Skip to content

iolog: free io_piece log on thread cleanup#1

Open
hanee-kim wants to merge 1 commit into
masterfrom
claude/fix-iolog-memory-leak-XIi6F
Open

iolog: free io_piece log on thread cleanup#1
hanee-kim wants to merge 1 commit into
masterfrom
claude/fix-iolog-memory-leak-XIi6F

Conversation

@hanee-kim
Copy link
Copy Markdown
Owner

prune_io_piece_log() is called only at the start of each loop
iteration, so io_piece entries accumulated during the final do_io()
run are never explicitly freed.

When fio runs as a process this goes unnoticed because the OS reclaims
the heap on exit. When fio is embedded as a pthread (e.g. used as a
library), the parent process keeps running, so those allocations become
a genuine memory leak proportional to the number of write IOs logged
for verify (~112 bytes per io_piece).

Fix by calling prune_io_piece_log() in the thread cleanup path before
cleanup_io_u(), mirroring the existing call at the top of the run loop.

https://claude.ai/code/session_016tpS4vTP5NurWyYqbumnGT

prune_io_piece_log() is called only at the start of each loop
iteration, so io_piece entries accumulated during the final do_io()
run are never explicitly freed.

When fio runs as a process this goes unnoticed because the OS reclaims
the heap on exit. When fio is embedded as a pthread (e.g. used as a
library), the parent process keeps running, so those allocations become
a genuine memory leak proportional to the number of write IOs logged
for verify (~112 bytes per io_piece).

Fix by calling prune_io_piece_log() in the thread cleanup path before
cleanup_io_u(), mirroring the existing call at the top of the run loop.

https://claude.ai/code/session_016tpS4vTP5NurWyYqbumnGT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants