Thread overview
Get memory used by current process at specific point in time
Jan 12, 2020
Per Nordlöw
Jan 13, 2020
Jacob Carlborg
Jan 13, 2020
Per Nordlöw
Jan 15, 2020
Chris Katko
Jan 15, 2020
Jacob Carlborg
Jan 16, 2020
Boris Carvajal
January 12, 2020
Is there a druntime/phobos function for getting the amount of memory (both, stack, malloc, and GC) being used by the current process?
January 13, 2020
On 2020-01-12 14:58, Per Nordlöw wrote:
> Is there a druntime/phobos function for getting the amount of memory (both, stack, malloc, and GC) being used by the current process?

I don't think so. But if you're on macOS you can use Instruments (shipped with Xcode) and pick the Allocations template.

-- 
/Jacob Carlborg
January 13, 2020
On Monday, 13 January 2020 at 20:08:19 UTC, Jacob Carlborg wrote:
> On 2020-01-12 14:58, Per Nordlöw wrote:
>> Is there a druntime/phobos function for getting the amount of memory (both, stack, malloc, and GC) being used by the current process?
>
> I don't think so. But if you're on macOS you can use Instruments (shipped with Xcode) and pick the Allocations template.

I'm sitting on Linux :)

Thanks anway
January 15, 2020
On Sunday, 12 January 2020 at 13:58:18 UTC, Per Nordlöw wrote:
> Is there a druntime/phobos function for getting the amount of memory (both, stack, malloc, and GC) being used by the current process?

Valgrind will tell you the exact usage (except no delineation for GC) per here:

https://stackoverflow.com/questions/131303/how-to-measure-actual-memory-usage-of-an-application-or-process

Valgrind is an overall extremely useful tool for Linux devs.

Still, some internal instrumentation would be nice. But I'm not aware of any.


January 15, 2020
On 2020-01-15 19:45, Chris Katko wrote:

> Still, some internal instrumentation would be nice. But I'm not aware of any.

There are some runtime flags that can be passed to the executable when running it to get some info about the GC. Of course these are not documented (except perhaps in the changelog). I'm too lazy to try to find them now.

-- 
/Jacob Carlborg
January 16, 2020
On Sunday, 12 January 2020 at 13:58:18 UTC, Per Nordlöw wrote:
> Is there a druntime/phobos function for getting the amount of memory (both, stack, malloc, and GC) being used by the current process?

At least for the GC I remember using GC.stats and GC.profileStats to get some info.

https://dlang.org/phobos/core_memory.html#.GC