www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16564] New: KRRegion.empty sometimes returns Ternary.no


          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: nobody puremagic.com
          Reporter: temtaime gmail.com

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);

        void[][] bufs;

        foreach(_; 0..10_000)
            bufs ~= a.allocate(uniform(1, buf.length));

        foreach(b; bufs.randomCover)

        if(a.empty == Ternary.no) break;

    writeln(`all the elements are freed but allocator is not empty !`);

Sep 29 2016