https://issues.dlang.org/show_bug.cgi?id=18849
Issue ID: 18849
Summary: std.allocator: AllocatorList uses deallocate and
ignores return value in deallocateAll
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: [email protected]
Reporter: [email protected]
AllocatorList's deallocateAll has the code:
if (special)
{
special.deallocate(allocators);
}
This has the issues:
- The return value is ignored. If the deallocation failed, the failure should
be communicated to the caller. Currently, this causes a silent memory leak.
- Some allocators, such as Region, can deallocateAll, but cannot deallocate.
Ideally the complete inability to deallocate() should be detected at
compile-time, and such combinations rejected.
- The documentation of AllocatorList has two examples of using it with Region,
which will not work (leak memory) due to the above.
--