On 19/07/17 21:52, Gabor Szabo wrote:
> is it possible to get the size of memory used by the current Perl 6
> process? (From inside the code)
> Is it possible to get the size of the individual variables?
I'm not aware of something cross-platform that rakudo offers for memory
use of a process, and getting the size of individual variables is an
extremely hairy topic.
You can use the --profile=heap target to get full snapshots of all
objects in memory whenever GC kicks in, and go through it with the
moar-heapanalyzer tool jnthn made.
I had a pull-request open for an op i called "vmhealth" that would
output a bunch of statistics including what the different allocators are
doing, but progress halted when I didn't get input or came up with good
ideas for what else to include. Here's the PR:
The reason why "memory in use" is difficult is because of many things
not having a single owner. Imagine an array, where you could have bound
the individual containers to any amount of lexical variables, for example.
Also, if there's exactly one Rat in the whole program, do you count the
presence of the class itself as being used by the variable that holds
hope that sheds some light