2014-05-19 23:19 GMT-04:00 L. David Baron <[email protected]>:

> On Monday 2014-05-19 20:09 -0700, Nicholas Nethercote wrote:
> > On Mon, May 19, 2014 at 5:32 PM, L. David Baron <[email protected]>
> wrote:
> > > Another is being able to find the root strongly connected components
> > > of the memory graph, which is useful for finding leaks in other
> > > systems (e.g., leaks of trees of GTK widget objects) that aren't
> > > hooked up to cycle collection.  It's occasionally even a faster way
> > > of debugging non-CC but nsTraceRefcnt-logged reference counted
> > > objects.
> >
> > How does trace-malloc do that? It sounds like it would need to know
> > about object and struct layout.
>
> Roughly the same way a conservative collector would -- assuming any
> word-aligned memory in one object in the heap that contains
> something that's the address of something else in the heap
> (including in the interior of the allocation) is a pointer to that
> object in the heap.
>
> (It's actually done in the leaksoup tool outside of trace-malloc.)
>

For that, I believe that the right approach at this point would be to use
DMD's memory/replace tool (maybe evolving it to suit your needs),

http://hg.mozilla.org/mozilla-central/file/cb9f34f73ebe/memory/replace/dmd

You could also write your own memory/replace tool sitting next to that one,
but it seems that every such tool needs to do roughly the same things, i.e.
store metadata around heap blocks and allow iterating over them, so they
might as well be the same tool.

Notice that I needed to do the same things in refgraph (
https://github.com/bjacob/mozilla-central/wiki/Refgraph, a tool to
investigate the graph of strong references between heap blocks) and at that
time wrote my own memory/replace tool (memory/replace/refgraph in that
fork). But it's been the most expensive part of that fork, in terms of
maintenability and portability. If I had time to continue work on this, the
first thing I'd do would be to drop that custom memory/replace tool and
instead just use DMD's.

Benoit


>
> -David
>
> --
> 𝄞   L. David Baron                         http://dbaron.org/   𝄂
> 𝄢   Mozilla                          https://www.mozilla.org/   𝄂
>              Before I built a wall I'd ask to know
>              What I was walling in or walling out,
>              And to whom I was like to give offense.
>                - Robert Frost, Mending Wall (1914)
>
> _______________________________________________
> dev-platform mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-platform
>
>
_______________________________________________
dev-platform mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to