Hunting down rogue memory allocations?

Kiith-Sa via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 3 02:27:48 PDT 2014


On Friday, 3 October 2014 at 08:18:45 UTC, thedeemon wrote:
> On Thursday, 2 October 2014 at 20:16:56 UTC, Gary Willoughby 
> wrote:
>> Say i have created a program written in D, what tools are 
>> available for me to track memory allocations?
>
> I wrote a tiny module trackallocs.d that inserts a GC proxy and 
> outputs to log file (or stdout) all the allocations, gathering 
> some stats.
>
> You can turn tracking on and off in any place of your code.
>
> Used it before 2.066 where @nogc appeared to check whether my 
> code was allocation-free. Current version works in both 2.066 
> and earlier versions. Find it here:
> https://bitbucket.org/infognition/dstuff/src/
>
> Inside it uses one hack based on knowledge of D runtime 
> internals, so in future versions of D runtime, if Proxy struct 
> changes again, it may need to be changed as well.

This is really cool stuff, I needed something like this but 
didn't know it was possible.

Mind if I use some parts of it in my profiler? (there's no 
license)


More information about the Digitalmars-d-learn mailing list