Skip to content

Replace std::dequeue in src/pooled_string.cpp with fixed size array - #992

Open
flohoff wants to merge 1 commit into
systemed:masterfrom
flohoff:master
Open

flohoff wants to merge 1 commit into
systemed:masterfrom
flohoff:master

Conversation

@flohoff

@flohoff flohoff commented Nov 14, 2026

Copy link
Copy Markdown

While debugging crashes in the Debian tilemaker 3.0.0 i found race crashes in this section as the former std::vector<char*> tables was accessed for dereferencing while other threads used emplace_back and the whole vector was reallocated.

I saw the current git head replaced std::vector with std::dequeue which makes the race less likely.

This solution replaces the std::dequeue with a fixed size pointer array which is lazily allocated by the OS when not touched. So all read accesses are perfectly safe without locking.

While debugging crashes in the Debian tilemaker 3.0.0 i found
race crashes in this section as the former std::vector<char*> tables
was accessed for dereferencing while other threads used emplace_back
and the whole vector was reallocated.

I saw the current git head replaced std::vector with std::dequeue
which makes the race less likely.

This solution replaces the std::dequeue with a fixed size
pointer array which is lazily allocated by the OS when not
touched. So all read accesses are perfectly safe without
locking.
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.

1 participant