Tracing allocations with "new" in dmd

Stefan Koch uplink.coder at googlemail.com
Fri Jun 19 14:42:19 UTC 2020


On Friday, 19 June 2020 at 14:23:10 UTC, Stefan Koch wrote:
> On Friday, 19 June 2020 at 13:45:23 UTC, Andrei Alexandrescu 
> wrote:
>> dmd does most of its allcoation with new. I wonder what would 
>> be the easiest way to track how many instances of each type 
>> are created.
>>
>> There are over 3000 call sites, so ideally the changes to the 
>> source would be entirely automatic (e.g. with sed).
>>
>> Would be in your debt for any ideas. Thanks!
>
> I have a tracing tool.
> USE IT.

it's here:
https://github.com/UplinkCoder/dmd/tree/dmd_tracing_2092

Currently I am still hunting down a bug which seems to be caused,
By tracing a temporary allocated, expression which will then lead 
to a segfault while writing the trace.

But I would very much like for others to use it, it's designed to 
allow you to say which source_code takes the most time out of the 
front-end process and where.

You will have to modify the source code of dmd to investigate 
particular issues,
But it comes with a number of likely candidates pre-selected for 
tracing.

I am happy to work with someone on up-streaming this and making 
it better.


More information about the Digitalmars-d mailing list