C# Interop

Rainer Schuetze r.sagitario at gmx.de
Thu Feb 3 23:34:35 PST 2011


I forgot one more thing: I don't know how juno deals with it, but I 
consider the default memory management of COM objects in phobos/druntime 
rather unusable. It leaks memory and can easily cause garbage collection 
on objects still referenced by COM objects. That's why I use 
http://d.puremagic.com/issues/show_bug.cgi?id=4092

Rainer

Richard Webb wrote:
>>> I assume that you do quite a lot of initialization for TLS
> 
> I'm not directly, but Juno has a number of static class constructors that allocate
> static members, and Outlook creates lots of threads (for example, i see the static
> constructor of the module juno.com.core get called 20+ times on startup).
> The Juno lib predates the TLS changes in D2 so i guess that some of these static
> variables don't need to be thread local, but i haven't had chance to investigate that.
> 
> 
>>> Are you using callbacks into the C++ DLL from the module ctors
> 
> The D dll just exports a couple of 'C' functions that the C++ dll calls. There are
> no calls in the other direction.
> 
> 
>>> that might work better if the C++ part also uses thread local storage
> 
> The C++ dll uses ATL for it's COM stuff, and i'm not sure what that does with TLS
> in the background.
> 
> I'll try your suggested change tommorow.
> 
> Thanks,
> Richard Webb


More information about the Digitalmars-d mailing list