Bug 18849 – std.allocator: AllocatorList uses deallocate and ignores return value in deallocateAll

Status
NEW
Severity
normal
Priority
P3
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-05-10T11:43:54Z
Last change time
2024-12-01T16:33:42Z
Assigned to
Eduard Staniloiu
Creator
Vladimir Panteleev
Moved to GitHub: phobos#10335 →

Comments

Comment #0 by dlang-bugzilla — 2018-05-10T11:43:54Z
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.
Comment #1 by robert.schadek — 2024-12-01T16:33:42Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10335 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB