Am Sat, 10 Nov 2012 09:12:55 -0800 schrieb Dan Olson <zans.is.for.c...@yahoo.com>:
> So far I am having fun gradually pushing D into apple ios sim (it runs > i386 not arm). I am curious though about thread local storage and GC. > I saw older posts about it being an issue and have not seen anything > more on it. Is it still an issue? I am doing all this with latest D > git and gcc-4.8-20121028 snapshot. > > What I gather is that D TLS vars are not monitored by the collector so > memory can be prematurely collected. Is that right? Yes. The GC needs special runtime / compiler support to scan TLS variables and this code has traditionally been buggy / difficult to implement. You can use a simple test to detect the most obvious errors: ------------------------------------------------------------ import std.stdio; import core.memory; class A { string str; void a() { writeln(this.str); } } A var; //TLS variable void main() { var = new A(); var.str = "Hello World"; GC.collect(); //Force collection var.a(); }