How to find what is causing a closure allocation

Adam D. Ruppe destructionator at gmail.com
Wed Oct 2 15:28:25 UTC 2019


On Wednesday, 2 October 2019 at 15:19:43 UTC, John Colvin wrote:
> profilegc.log only gives me the line number of the function 
> signature, which doesn't give me any hint as to where in the 
> function the closure is allocated.

You'll wanna check any nested functions declared in that 
function. Kinda easier said than done with text tools (I should 
make a helper tool to do this more reliably like dscanner style), 
but they will have either the symbol { (hence why it is such a 
pain) or => and will reference a local variable in the function.

So it is kinda sucky but first is prolly search =>, maybe get 
lucky, then just start going down the { symbols and find a thing 
there.

It is tedious but it shouldn't be too bad, at least if the 
compile is quick enough that you can comment the body, recompile 
and see if the -vgc still lists the function, or have a reliable 
way of scanning for local variables.


More information about the Digitalmars-d-learn mailing list