version(ctfe)

Leandro Lucarella llucax at gmail.com
Mon Oct 19 08:40:14 PDT 2009


Andrei Alexandrescu, el 19 de octubre a las 10:33 me escribiste:
> Leandro Lucarella wrote:
> >Andrei Alexandrescu, el 19 de octubre a las 08:38 me escribiste:
> >>For relatively large chunks of memory, the GC keeps a control block.
> >>We could add a member size_t requestedSize that keeps the size that
> >>was requested with an allocation/reallocation call. The GC can take
> >>initiative in overallocating memory and expose primitives such as
> >>requestedSize (how much did the program ask for?) and capacity (how
> >>much is really allocated?).  With that API, it is possible to
> >>implement ~= efficiently.
> >
> >That would mean moving the overhead of arrays to the GC, but that overhead
> >will be present for *all* objects, arrays or not, so I don't think it will
> >be a good idea...
> 
> I forgot to mention that ~= would also have a means to communicate
> the GC to overallocate. My point is simple: the problem is that
> slices don't  store enough info. That info could get in the memory
> control block.

The control block is not part of the object's memory, so I don't think
it's something you want to manipulate frequently (because of locality
issues). This works well for the GC because when you manipute control
information often is when you are collecting, so for collection most of
the control info should be cached and have good locality. In collections
you have the exact opposite scheme, you don't look at the data, only the
control info. When you manipulate an array you will be probably touching
both. That's why I think you should keep all the array data in one place.
Well, that and because I don't think is a good idea to transfer array
complexities to the GC. It's just not the place for that.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Si por el chancho fuera, se autocomería con chimichurri Worshestershire!



More information about the Digitalmars-d mailing list