[Issue 16824] std.experimental.allocator.dispose leaks memory for arrays of more than 1 dimension

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Dec 21 17:22:45 PST 2016


https://issues.dlang.org/show_bug.cgi?id=16824

--- Comment #1 from Andrei Alexandrescu <andrei at erdani.com> ---
OK, so what we have here at the core is this:

    auto ints2d = allocator.makeArray!(int[])(2);
    foreach(ref ints1d; ints2d)
        ints1d = allocator.makeArray!(int)(3);

What I see here by means of manual coding: 

* Create an array of int[] using an allocator
* Create a bunch of arrays of int using the same allocator

This is again by means of manual coding. The individual arrays might have been
created using a different allocator, or sliced from a larger buffer.

I don't think we should expect the top-level allocator to "know" (assume
really) that everything was allocated with the same allocator.

--


More information about the Digitalmars-d-bugs mailing list