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
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/f730d230f5ee56efea465f8f32b1ecb49e4542cf Fixed Issue 16253 - BitmappedBlock allocator not working with chooseAtRuntime https://github.com/dlang/phobos/commit/20413aed16912cabd47a7cc081f1380cfddb7eb7 Merge pull request #5854 from jercaianu/bitmap_chooseAtRuntime Fixed Issue 16253 - BitmappedBlock allocator not working with chooseAtRuntime merged-on-behalf-of: Andrei Alexandrescu <[email protected]>
Comment #2 by github-bugzilla — 2017-12-18T22:56:38Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/f730d230f5ee56efea465f8f32b1ecb49e4542cf Fixed Issue 16253 - BitmappedBlock allocator not working with chooseAtRuntime https://github.com/dlang/phobos/commit/20413aed16912cabd47a7cc081f1380cfddb7eb7 Merge pull request #5854 from jercaianu/bitmap_chooseAtRuntime