https://issues.dlang.org/show_bug.cgi?id=16564
Issue ID: 16564
Summary: KRRegion.empty sometimes returns Ternary.no
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
I just tried it as video memory allocator for my engine and empty sometimes
don't work: try to allocate and then deallocate in a random order.
For example
void main()
{
ubyte[256 * 1024] buf;
auto a = KRRegion!()(buf);
while(true)
{
void[][] bufs;
foreach(_; 0..10_000)
{
bufs ~= a.allocate(uniform(1, buf.length));
}
foreach(b; bufs.randomCover)
{
a.deallocate(b);
}
if(a.empty == Ternary.no) break;
}
writeln(`all the elements are freed but allocator is not empty !`);
}
--