Bug 16253 – BitmappedBlock allocator not working with chooseAtRuntime
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-07-08T17:25:27Z
Last change time
2017-12-18T22:56:38Z
Assigned to
Andrei Alexandrescu
Creator
Lodovico Giaretta
Comments
Comment #0 by lodovico — 2016-07-08T17:25:27Z
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).
Comment #1 by github-bugzilla — 2017-11-13T17:39:26Z