std.allocator ready for some abuse

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Oct 26 23:10:14 PDT 2013


On 10/26/13 5:23 AM, Johannes Pfau wrote:
> Some small nitpicks:
> * byAllocation is not accessible from outside std.allocator

Fixed.

> * Is it intentional that AllocatorWithStats can't log the
>    __FUNCTION__ / __PRETTY_FUNCTION__ ?

Just an omission, good idea! Fixed. Let's just record __FUNCTION__.

> * The documentation for byAllocation should probably state that it only
>    lists 'alive' allocations and that this is especially useful for
>    finding memory leaks.

Fixed.

> And one bigger problem: CAllocatorImpl doesn't work well with
> AllocatorWithStats.
>
> AllocatorWithStats special members (byAllocation, etc) are not
> directly accessible. Although we can access them by using .impl it'd be
> nice to have a special AllocatorWithStats class which directly exposes
> those members.

That shouldn't be a problem - just downcast to 
CAllocatorImpl!AllocatorWithStats and you got access.

> The second problem is that the logged file/line is always in
> std.allocator.d. It's probably not easy to get this working in all
> cases (especially regarding polymorphism).

Uhm, that /is/ a problem.


Andrei



More information about the Digitalmars-d mailing list