www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19025] New: Better definition of deallocateAll in

https://issues.dlang.org/show_bug.cgi?id=19025

          Issue ID: 19025
           Summary: Better definition of deallocateAll in
                    ContiguousFreeList
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: mmcomando gmail.com

Deallocation of all memory in ContiguousFreeList can be done without using
parent.deallocateAll. Buffer used by ContiguousFreeList is always allocated by
parent so deallocateAll it should be enought to implement deallocateAll.

If I understand everything properly such an implementation would be enought:

bool deallocateAll()
{
    bool result = parent.deallocate(support);
    allocated = 0;
    return result;
}


I am not sure but current implementation might be wrong because it is calling
parent.deallocateAll() and parent might have been used to allocate some other
data not only buffer for ContiguousFreeList.

--
Jun 25 2018