[phobos] Gcx: Would we ever want more than one?

Sean Kelly sean at invisibleduck.org
Sat May 14 17:28:45 PDT 2011


Technically, you want a free list per core. I don't know how practical it is to figure that out though. 

Sent from my iPhone

On May 12, 2011, at 8:14 PM, David Simcha <dsimcha at gmail.com> wrote:

> On 5/12/2011 11:05 PM, Walter Bright wrote:
>> 
>> 
>> On 5/12/2011 8:01 PM, David Simcha wrote:
>>> I'm looking to get rid of the global malloc lock for small memory allocations.  A major barrier to pulling this off within the current GC design is the fact that Gcx is a struct, which suggests the possibility of having more than one instance and makes it more difficult to create thread-local objects.  Is there any reason why we would ever want more than one garbage collector instance?  If not, why is Gcx a struct instead of just a bunch of __gshared variables?
>>> 
>> 
>> You can get multiple Gcx instances when you're connecting DLL instances together. That's why the druntime allows you the means to pick one.
>> 
>> Also, grouping them together in a single struct is good encapsulation practice, rather than a random distributed collection of globals.
>> 
> 
> Crap.  This means I'm going to have to get creative and figure out a way to get storage that's local to both a Gcx instance and a thread.  Definitely do-able, but not pretty.
> 
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos


More information about the phobos mailing list