Re: GSlice - Re: [OT] About GC: The Future of Rust : GC integration

2016-06-10 Thread Nick Treleaven via Digitalmars-d

On Wednesday, 8 June 2016 at 17:23:22 UTC, deadalnix wrote:
I wonder if Andrei's allocator API supports freeing with a 
size argument.

...
This extra bit of infos seems to be less useful in practice 
than you'd naively expect. Someone may come up with something 
interesting to do with it someday, but I haven't seen anything 
that groundbreaking so far.


OK. What if the allocation size was passed as a compile time 
parameter on deallocation? Then CTFE could calculate e.g. the 
next power of 2.




Re: GSlice - Re: [OT] About GC: The Future of Rust : GC integration

2016-06-09 Thread Nick Treleaven via Digitalmars-d
On Wednesday, 8 June 2016 at 12:38:25 UTC, Andrei Alexandrescu 
wrote:

On 6/8/16 1:59 PM, Nick Treleaven wrote:
I wonder if Andrei's allocator API supports freeing with a 
size argument.


Size is required with all deallocations. -- Andrei


Thanks. So I suppose it's up to each allocator whether this will 
work or not:


alloc.makeArray!T(5).ptr.Alias!(p => alloc.dispose(p));

I guess it would work for Mallocator.


Re: GSlice - Re: [OT] About GC: The Future of Rust : GC integration

2016-06-08 Thread deadalnix via Digitalmars-d

On Wednesday, 8 June 2016 at 11:59:49 UTC, Nick Treleaven wrote:

On Wednesday, 8 June 2016 at 03:50:26 UTC, deadalnix wrote:
(a fast malloc already needs to be able to find the allocation 
metadata from free's argument effisciently,


BTW GLib (GTK+) have a GSlice API that doesn't allow resizing 
and requires the allocation size to be passed when freeing:


https://developer.gnome.org/glib/stable/glib-Memory-Slices.html#glib-Memory-Slices.description

I wonder if Andrei's allocator API supports freeing with a size 
argument.


Yes, there are many of these initiatives these days. I was 
initially enthusiastic, but truth is, nobody has been able to 
produce anything that beat tcmalloc or jemalloc (clearly the king 
in town these days).


This extra bit of infos seems to be less useful in practice than 
you'd naively expect. Someone may come up with something 
interesting to do with it someday, but I haven't seen anything 
that groundbreaking so far.




Re: GSlice - Re: [OT] About GC: The Future of Rust : GC integration

2016-06-08 Thread Andrei Alexandrescu via Digitalmars-d

On 6/8/16 1:59 PM, Nick Treleaven wrote:

I wonder if Andrei's allocator API supports freeing with a size argument.


Size is required with all deallocations. -- Andrei