[Issue 18849] New: std.allocator: AllocatorList uses deallocate and ignores return value in deallocateAll
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 10 11:43:54 UTC 2018
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: nobody at puremagic.com
Reporter: dlang-bugzilla at thecybershadow.net
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.
--
More information about the Digitalmars-d-bugs
mailing list