You signed in with another tab or
8000
window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Thread safety of ALP: Should static arrays in encoder be thread_local for multithreaded compression? #41
Since these are static, they are shared between threads and could cause data races during parallel compression.
Would it be correct to change these to thread_local static to make the function thread-safe? Or is there a recommended way to use ALP safely in a multithreaded context?
You are completely right. The static arrays should be changed to thread_local to make the encoder safe in multithreaded contexts. This change will not cause any issues for ALP.
The recommended long-term approach is to allocate these buffers through a buffer manager to monitor and limit total memory usage.
I’d be happy to review a PR that makes the initial change (static → thread_local).
Activity
azimafroozeh commentedon Oct 16, 2025
Hi,
You are completely right. The
staticarrays should be changed tothread_localto make the encoder safe in multithreaded contexts. This change will not cause any issues for ALP.The recommended long-term approach is to allocate these buffers through a buffer manager to monitor and limit total memory usage.
I’d be happy to review a PR that makes the initial change (
static→thread_local).Thanks for catching this!