Re: std.allocator issues

2016-03-11 Thread Marco Leise via Digitalmars-d
Am Tue, 8 Mar 2016 16:35:45 -0500 schrieb Andrei Alexandrescu : > On 3/7/16 11:53 PM, Marco Leise wrote: > > By the way: jemalloc has `mallocx()` to allocate at least N > > bytes and `sallocx()` to ask for the actual size of an > > allocation. > > I know. Jason added them at my behest. -- Andrei

Re: std.allocator issues

2016-03-08 Thread Andrei Alexandrescu via Digitalmars-d
On 3/7/16 11:53 PM, Marco Leise wrote: By the way: jemalloc has `mallocx()` to allocate at least N bytes and `sallocx()` to ask for the actual size of an allocation. I know. Jason added them at my behest. -- Andrei

Re: std.allocator issues

2016-03-07 Thread Marco Leise via Digitalmars-d
Am Sat, 20 Feb 2016 08:47:47 -0500 schrieb Andrei Alexandrescu : > On 02/20/2016 12:39 AM, Steven Schveighoffer wrote: > > Given that there is "goodAllocSize", this seems reasonable. But for > > ease-of-use (and code efficiency), it may be more straightforward to > > allow returning more data than

Re: std.allocator issues

2016-02-20 Thread Andrei Alexandrescu via Digitalmars-d
On 02/20/2016 10:00 AM, Steven Schveighoffer wrote: I found some bugs in GCAllocator.expand, will submit a PR. Thx! -- Andrei

Re: std.allocator issues

2016-02-20 Thread Steven Schveighoffer via Digitalmars-d
On 2/20/16 8:47 AM, Andrei Alexandrescu wrote: On 02/20/2016 12:39 AM, Steven Schveighoffer wrote: Given that there is "goodAllocSize", this seems reasonable. But for ease-of-use (and code efficiency), it may be more straightforward to allow returning more data than requested (perhaps through an

Re: std.allocator issues

2016-02-20 Thread Andrei Alexandrescu via Digitalmars-d
On 02/20/2016 12:39 AM, Steven Schveighoffer wrote: Given that there is "goodAllocSize", this seems reasonable. But for ease-of-use (and code efficiency), it may be more straightforward to allow returning more data than requested (perhaps through another interface function? allocateAtLeast?) and

Re: std.allocator issues

2016-02-19 Thread Steven Schveighoffer via Digitalmars-d
On 2/20/16 12:22 AM, Andrei Alexandrescu wrote: On 02/19/2016 10:12 PM, Steven Schveighoffer wrote: On 2/19/16 9:21 PM, Steven Schveighoffer wrote: I'm trying to use the std.experimental.allocator API more in my new io library, and I'm having a few stumbling points: Another thought: Allocato

Re: std.allocator issues

2016-02-19 Thread Andrei Alexandrescu via Digitalmars-d
On 02/19/2016 09:21 PM, Steven Schveighoffer wrote: I'm trying to use the std.experimental.allocator API more in my new io library, and I'm having a few stumbling points: 1. GCAllocator only allocates void, which is marked as containing pointers. This is no good for a stream buffer, and can seve

Re: std.allocator issues

2016-02-19 Thread Andrei Alexandrescu via Digitalmars-d
On 02/19/2016 10:12 PM, Steven Schveighoffer wrote: On 2/19/16 9:21 PM, Steven Schveighoffer wrote: I'm trying to use the std.experimental.allocator API more in my new io library, and I'm having a few stumbling points: Another thought: Allocators return void[] when requesting allocations, rea

Re: std.allocator issues

2016-02-19 Thread Steven Schveighoffer via Digitalmars-d
On 2/19/16 9:21 PM, Steven Schveighoffer wrote: I'm trying to use the std.experimental.allocator API more in my new io library, and I'm having a few stumbling points: Another thought: Allocators return void[] when requesting allocations, reallocations, etc. For C malloc, the assumption must b

Re: std.allocator issues

2016-02-19 Thread rsw0x via Digitalmars-d
On Saturday, 20 February 2016 at 02:21:00 UTC, Steven Schveighoffer wrote: I'm trying to use the std.experimental.allocator API more in my new io library, and I'm having a few stumbling points: 1. GCAllocator only allocates void, which is marked as containing pointers. This is no good for a st

std.allocator issues

2016-02-19 Thread Steven Schveighoffer via Digitalmars-d
I'm trying to use the std.experimental.allocator API more in my new io library, and I'm having a few stumbling points: 1. GCAllocator only allocates void, which is marked as containing pointers. This is no good for a stream buffer, and can severely harm performance. 2. GCAllocator provides a