[Issue 16253] New: BitmappedBlock allocator not working with chooseAtRuntime
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jul 8 10:25:27 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16253
Issue ID: 16253
Summary: BitmappedBlock allocator not working with
chooseAtRuntime
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: lodovico at 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]);
writeln(alloc.blockSize);
}
Error: template instance
std.experimental.allocator.building_blocks.bitmapped_block.BitmappedBlock!(18446744073709551614LU,
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).
--
More information about the Digitalmars-d-bugs
mailing list