4 ms·
I've heard conflicting things here. I was under the impression that Go was not memory safe while mutating maps without synchronization. For example, these arti
by pcwalton 14y ago
I've heard conflicting things here. I was under the impression that Go was not memory safe while mutating maps without synchronization.
For example, these articles allude to possible memory corruption:
http://golang.org/doc/articles/race_detector.html http://golang.org/doc/articles/race_detector.html "memory corruption"
http://golang.org/doc/faq#atomic_maps http://golang.org/doc/faq#atomic_maps
http://talks.golang.org/2012/splash.article http://talks.golang.org/2012/splash.article "Go is not purely memory safe in the presence of concurrency."
- 4ad 14y agoYou are correct, I was presenting a simplified view. While Go was designed with memory safety in mind, the specification does not guarantee memory safety. With that being said, it also doesn't preclude it (unlike C). For example, the gc implementation without parallelism (not to be confused with concurrency) is memory safe while the gc implementation with parallelism is not. This is the reason why GOMAXPROCS is always 1 in the playground and on the App Engine. There's nothing precluding a paralel implementation from also being memory safe.