www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16253] New: BitmappedBlock allocator not working with


          Issue ID: 16253
           Summary: BitmappedBlock allocator not working with
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: lodovico giaretart.net

This simple code does not compile:

import std.stdio;
import std.experimental.allocator;
import std.experimental.allocator.common;
import std.experimental.allocator.building_blocks.bitmapped_block;

void main()
    auto alloc = BitmappedBlock!chooseAtRuntime(new void[1024]);

Error: template instance
16u, NullAllocator) error instantiating

This instantiation error looks like an easily fixeable bug.
The real problem is that, if I understand correctly, BitmappedBlock, in its
current form, will *never* work with chooseAtRuntime, because the constructors
need to know the blockSize, and there's no way to set it at runtime before the
constructor is executed.
The documentation explicitly says that with chooseAtRuntime the blockSize shall
be passed to the constructor, but no constructor takes it (one takes a void[]
block and the other the total memory size requested).

Jul 08 2016