From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: Memory accounting in libgc Date: Thu, 13 Mar 2014 14:46:42 +0000 Message-ID: <35f83e83d1f068b600cfa2f8b832b88e@ossau.homelinux.net> References: <87k3c33awa.fsf@pobox.com> <874n339a4z.fsf@yeeloong.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1394722012 25934 80.91.229.3 (13 Mar 2014 14:46:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Mar 2014 14:46:52 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Mar 13 15:47:00 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WO6uS-00085U-8E for guile-devel@m.gmane.org; Thu, 13 Mar 2014 15:47:00 +0100 Original-Received: from localhost ([::1]:39533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WO6uR-0002bs-U4 for guile-devel@m.gmane.org; Thu, 13 Mar 2014 10:46:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WO6uK-0002Yo-L0 for guile-devel@gnu.org; Thu, 13 Mar 2014 10:46:58 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WO6uE-0002Wo-Lj for guile-devel@gnu.org; Thu, 13 Mar 2014 10:46:52 -0400 Original-Received: from out1.ip04ir2.opaltelecom.net ([62.24.128.240]:19490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WO6uE-0002WT-EV for guile-devel@gnu.org; Thu, 13 Mar 2014 10:46:46 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgENAALEIVNOlcwU/2dsb2JhbABZgwaDRlK+WAMCgRUXdIIlAQEBAQMjFR4zBAQDGAICJgICLA0eGQiHdbF/oWAXFoETh3OFSBaCWYFJAQOYRZItgy09 X-IPAS-Result: AgENAALEIVNOlcwU/2dsb2JhbABZgwaDRlK+WAMCgRUXdIIlAQEBAQMjFR4zBAQDGAICJgICLA0eGQiHdbF/oWAXFoETh3OFSBaCWYFJAQOYRZItgy09 X-IronPort-AV: E=Sophos;i="4.97,647,1389744000"; d="scan'208";a="438572829" Original-Received: from host-78-149-204-20.as13285.net (HELO arudy) ([78.149.204.20]) by out1.ip04ir2.opaltelecom.net with ESMTP; 13 Mar 2014 14:46:44 +0000 Original-Received: by arudy (Postfix, from userid 33) id F0E5D3805F; Thu, 13 Mar 2014 14:46:42 +0000 (GMT) X-PHP-Originating-Script: 0:rcmail.php In-Reply-To: <874n339a4z.fsf@yeeloong.lan> X-Sender: neil@ossau.homelinux.net User-Agent: Roundcube Webmail/0.9.5 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 62.24.128.240 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16968 Archived-At: On 2014-03-12 06:57, Mark H Weaver wrote: > Andy Wingo 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 Absolutely agree that this would be useful, but I suspect a problem in how far one can push libgc to simulate a set of objects being freed without them actually _being_ freed. For example there could be guardians associated with the objects, and I think one can validly imagine them doing either of the possible extremes (or anywhere in between), namely: - resurrecting the objects again - freeing up a whole load more objects/memory that the guardians know to be associated with the original objects, but which wasn't (for some reason) simply referenced by them. Hope that's a useful thought - interesting subject! Neil