lumberyard
lumberyard copied to clipboard
Statistics collection and thread safety fixes for AZ::IO::DedicatedCache
More fixes for problems addressed by https://github.com/aws/lumberyard/pull/494
While previous pull request fixed most of the issues the one remained:
-
DedicatedCache::DestroyDedicatedCache()call can happen right betweenDedicatedCache::CollectStatistics()call and any code that makes use of statistics collected (e.g.System.cpp @ 1745orDevice.cpp @ 96). This leads to accessing invalid memory through string views stored in statistics values and, particularly, to crashes on consoles.
The solution proposed (apart form guarding internal data members with locks) is to postpone removal of m_cachedStatNames entries until the very beginning of the next DedicatedCache::CollectStatistics() call.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Thanks for submitting these additional fixes @dkondrashkin, we're looking over the change and will update this PR with status changes or questions.