On 12/05/2022 4:55 AM, templatedperson wrote:
for a good reason, the default is the GC.

Good reason or not, people sometimes need to do manual memory management.

I usually use the GC and like that we have it, but if you care about performance you gotta drop down to manual managements sometimes. If libraries don't let users decide what sort of memory management pattern they want to use we have two languages essentially.

I'd rather all of phobos had overloads with allocator arguments, but sadly it doesn't.

They are classes hidden inside structs.

I'm well aware of the issues, I have my own -betterC allocator library (that will hopefully be available soon-ish) that does not have these issues.

```d
struct RCAllocator {
    private {
        void delegate() @safe @nogc pure nothrow refAdd_;
        void delegate() @safe @nogc pure nothrow refSub_;

void[]delegate(size_t, TypeInfo ti = null) @safe @nogc pure nothrow allocate_;
        bool delegate(scope void[]) @safe @nogc pure nothrow deallocate_;
bool delegate(scope ref void[], size_t) @safe @nogc pure nothrow reallocate_;
        Ternary delegate(scope void[]) @safe @nogc pure nothrow owns_;
        bool delegate() @safe @nogc pure nothrow deallocateAll_;
        bool delegate() @safe @nogc pure nothrow empty_;
    }

@safe @nogc pure nothrow:
```

Reply via email to