Trying to avoid memory allocations in critical sections.