C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Library facility for determining an object's memory use
From: Miguel Ojeda (miguel.ojeda.sandonis_at_[hidden])
Date: 2020-11-10 03:54:09


On Tue, Nov 10, 2020 at 4:28 AM Kyle Knoepfel via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> This can be helpful for flagging expensive operations at runtime, poor library use, etc.

It sounds useful for quick printout-style debugging, although those
example use cases need more detail. How would you use `memory_use` for
flagging expensive operations or detect poor library use?

> So the reported memory wouldn't necessarily correspond to what the object is responsible for, but rather what memory is attributed in anyway with that object.

I think it is more clear if it is only implemented for containers and
other RAII classes wherever it may make sense. For raw pointers, there
is no way to tell how much memory might be allocated behind them, if
any, unless you ask the allocator.

Cheers,
Miguel


STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups