www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Get memory used by current process at specific point in time

reply Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
Is there a druntime/phobos function for getting the amount of 
memory (both, stack, malloc, and GC) being used by the current 
process?
Jan 12 2020
next sibling parent reply Jacob Carlborg <doob me.com> writes:
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
Jan 13 2020
parent Per =?UTF-8?B?Tm9yZGzDtnc=?= <per.nordlow gmail.com> writes:
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
Jan 13 2020
prev sibling next sibling parent reply Chris Katko <ckatko gmail.com> writes:
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.
Jan 15 2020
parent Jacob Carlborg <doob me.com> writes:
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
Jan 15 2020
prev sibling parent Boris Carvajal <boris2.9 gmail.com> writes:
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
Jan 16 2020