Thread overview
[Issue 18854] std.allocator: StatsCollector counts failed deallocations
May 15, 2018
Vladimir Panteleev
Dec 17, 2022
Iain Buclaw
May 15, 2018
https://issues.dlang.org/show_bug.cgi?id=18854

Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei@erdani.com

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> ---
StatsCollector.deallocate is "Defined whether or not `Allocator.deallocate` is defined". I'm really not sure this was a great idea, because it opens the door to silent memory leaks, and breaks introspection of any allocators that might use this information to switch to a different method of tracking allocations.

There's two ways to fix this:

- Make deallocate always return false (and not count allocations) when
ParentAllocator doesn't support deallocation.
- Don't define deallocate if the parent allocator doesn't.

I feel like the first one would defeat the point of always having a deallocate method. Still, the way things are now is obviously broken.

Andrei, any thoughts?

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=18854

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--
December 01
https://issues.dlang.org/show_bug.cgi?id=18854

--- Comment #2 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/9758

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--