On Thu, Jul 20, 2017 at 12:37 PM, Timo Paulssen <t...@wakelift.de> wrote: > On 19/07/17 21:52, Gabor Szabo wrote: >> Hi, >> >> 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? >> >> Gabor > > 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: > https://github.com/MoarVM/MoarVM/pull/536 > > 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 > that Rat? > > hope that sheds some light > - Timo
Thanks for the explanation. I hope your PR will make progress. BTW the reason I asked this is as I think there is a memory leak somewhere in Bailador and I was hoping to use this to track it down. Any Perl 6 or Rakudo specific suggestions for that? Gabor