guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory accounting in libgc


From: Mark H Weaver
Subject: Re: Memory accounting in libgc
Date: Wed, 12 Mar 2014 02:57:48 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Andy Wingo <address@hidden> writes:

> How does this affect libgc?
>
> First of all, it gives an answer to the question of "how much memory
> does an object use" -- simply stop the world, mark the heap in two parts
> (the first time ignoring the object in question, the second time
> starting from the object), and subtract the live heap size of the former
> from the latter.  Libgc could do this without too much problem, it seems
> to me, on objects of any kind.  It would be a little extra code but it
> could be useful.  Or not?  Dunno.

This could be generalized to the far more useful question: "How much
memory does this set of objects use?", although that's a slippery
question that might better be formulated as "How much memory would be
freed if this set of objects were no longer needed?".

For example, suppose you have a large data structure that is referenced
from two small header objects, A and B.  If you ask "How much memory
does A use?", the answer will be the size of the small header, and ditto
for B.  Without being able to ask the more general question, there's no
way to find out how much would be freed by releasing both.

     Mark



reply via email to

[Prev in Thread] Current Thread [Next in Thread]