Thread overview
[Issue 15721] free error when calling Mallocator.dispose on interfaces
[Issue 15721] std.experimental.allocator dispose on interface
Feb 26, 2016
b2.temp@gmx.com
Feb 26, 2016
b2.temp@gmx.com
Feb 26, 2016
b2.temp@gmx.com
Feb 26, 2016
b2.temp@gmx.com
Mar 21, 2020
Basile-z
February 26, 2016
https://issues.dlang.org/show_bug.cgi?id=15721

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp@gmx.com

--- Comment #1 from b2.temp@gmx.com ---
GCAllocator is supported but Mallocator produces a free error:


import std.experimental.allocator.mallocator;
import std.experimental.allocator.gc_allocator;
import std.experimental.allocator;

interface Foo {}
class Bar: Foo {}

void main()
{
    GCAllocator.instance.dispose(cast(Foo) GCAllocator.instance.make!Bar);
    // comment the following line: OK
    Mallocator.instance.dispose(cast(Foo) Mallocator.instance.make!Bar);
}
February 26, 2016
https://issues.dlang.org/show_bug.cgi?id=15721

--- Comment #2 from b2.temp@gmx.com ---
I think this is safe to change dispose to:

void dispose(A, T)(auto ref A alloc, T p)
if (is(T == class) || is(T == interface))
{
    if (!p) return;
    auto support = (cast(void*) cast(Object) p)[0 .. typeid(p).init.length];
    destroy(p);
    alloc.deallocate(support);
}
February 26, 2016
https://issues.dlang.org/show_bug.cgi?id=15721

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|installer                   |phobos
           Hardware|x86_64                      |All
                 OS|Windows                     |All
           Severity|enhancement                 |normal

--
February 26, 2016
https://issues.dlang.org/show_bug.cgi?id=15721

b2.temp@gmx.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|std.experimental.allocator  |free error when calling
                   |dispose on interface        |Mallocator.dispose on
                   |                            |interfaces

--
March 03, 2016
https://issues.dlang.org/show_bug.cgi?id=15721

--- Comment #3 from github-bugzilla@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/211c10aff2b2cdfd9280f159cab7825b8a323c80 fixed issue 15721

https://github.com/D-Programming-Language/phobos/commit/e55e196127c75899a36016cba12b8cbd5c1548d9 Merge pull request #4022 from BBasile/issue-15721

fixed issue 15721 - std.experimental.allocator dispose on interface

--
March 03, 2016
https://issues.dlang.org/show_bug.cgi?id=15721

github-bugzilla@puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=15721

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--