Skip to content

Conversation

@ekg
Copy link
Collaborator

@ekg ekg commented Jul 29, 2025

Make sure everything is correctly initialized and destroyed.

ekg added 2 commits July 29, 2025 14:31
Initialize all boolean member variables to false in the Parameters struct
to prevent undefined behavior when the copy constructor is invoked.

UBSan previously reported:
runtime error: load of value 16, which is not a valid value for type 'bool'

This fix ensures all boolean fields have defined values on construction.
Added wrapper structs with destructors to properly clean up thread-local
faidx_reader_t objects in computeMap.hpp and map_stats.hpp.

Previously, thread-local readers were never destroyed, causing memory
leaks reported by AddressSanitizer (~4MB per run in test case).

The fix uses RAII pattern:
- computeMap.hpp: ReaderWrapper struct for single thread-local reader
- map_stats.hpp: ReaderMapWrapper struct for map of readers per file

This ensures readers are properly destroyed when threads terminate.
@ekg ekg merged commit ba06402 into main Jul 29, 2025
1 check passed
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