www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Print debug data

reply Alain De Vos <devosalain ymail.com> writes:
Is it possible to print runtime memory usage of:
-The stack
-The heap
-The garbage collector ?
Jul 16 2023
next sibling parent reply Chris Katko <ckatko gmail.com> writes:
On Monday, 17 July 2023 at 03:43:04 UTC, Alain De Vos wrote:
 Is it possible to print runtime memory usage of:
 -The stack
 -The heap
 -The garbage collector ?
there's gc.stats for part of it: https://dlang.org/library/core/memory/gc.stats.html
Jul 16 2023
parent reply devosalain <devosalain ymail.com> writes:
```

import std.stdio:writeln;
import core.memory;
void main(){
	ulong a=GC.Stats.freeSize;
	writeln(a);
}

```

returns error:
Error: need this for freeSize of type ulong
Jul 18 2023
parent reply Kagamin <spam here.lot> writes:
Naming is hard.
Jul 18 2023
parent reply Alain De Vos <devosalain ymail.com> writes:
?
Jul 18 2023
parent reply Steven Schveighoffer <schveiguy gmail.com> writes:
On 7/18/23 5:04 PM, Alain De Vos wrote:
 ?
use `stats` instead of `Stats`. The `Stats` name is the type, whereas the `stats` method is the call that gets the stats. It's kind of a terrible message, I wish it would change to something more informative. -Steve
Jul 18 2023
parent Dennis <dkorpel gmail.com> writes:
On Wednesday, 19 July 2023 at 01:13:23 UTC, Steven Schveighoffer 
wrote:
 It's kind of a terrible message, I wish it would change to 
 something more informative.
As of https://github.com/dlang/dmd/pull/15430, there's a new message: ``` accessing non-static variable `freeSize` requires an instance of type `Stats` ```
Jul 20 2023
prev sibling parent mw <mingwu gmail.com> writes:
On Monday, 17 July 2023 at 03:43:04 UTC, Alain De Vos wrote:
 Is it possible to print runtime memory usage of:
 -The stack
 -The heap
 -The garbage collector ?
And how to print the memory stats of each class / struct type? 
Apr 24