Hi Guys,
im thinknig about "garbage" collection algorithm that'll scan the memory that needs to be collected looking for expired items. The idea is to scan the memory that is being constantly written to, without locking, then after a potential expired item is found, use mutex to be sure that the value that is read is actually correct. Something like "double-read".
Example from line 24. It doesn't work in playground, only when compiled, of course race detector goes crazy.
I read that it is generally not advised to do that, can i corrupt eg. CPU cache this way, so after locking i'll still get "incorrect" value that is corrupted? Is there any potential problem with that approach, in C / Golang? Any way to "tell" race detector to be silent for some vars.
Thanks.