I had the same idea three days ago and @ringabout pointed me towards [this 
patch](https://github.com/nim-works/nimskull/commit/419675a47ff322ecde59905aac427ffd8a298e99)
 which I ported to an unmodified Nim 1.6 and published it 
[here](https://github.com/Yepoleb/Nim/commit/c7a8f914f7e531a8aedd4ba007a9e931d7081e52)
 for you (removed the VCC compatibility though).

I was long mislead by the memory management documentation which claims "The 
reference counting operations (= "RC ops") do not use atomic instructions and 
do not have to -- instead entire subgraphs are moved between threads.", but 
this apparently does not happen automatically and atomics are still necessary 
for concurrent access, which happens often enought that it should not simply be 
ignored. Knowing which parts memory will get touched by a procedure is often 
incredibly hard to determine before running the code, so moving it all 
beforehand is not realistic.

I am in strong support of your idea to add an option for this. Even if some 
consider atomic refcounts too slow to use for performance critical application, 
it's a great tool for prototyping without having to worry about manual memory 
management.

Reply via email to