From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mark H Weaver Newsgroups: gmane.lisp.guile.devel Subject: Re: Bringing back gc-live-object-stats Date: Wed, 15 May 2019 21:39:46 -0400 Message-ID: <87pnoji3cy.fsf@netris.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="1330"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) Cc: guile-devel To: Amirouche Boubekki Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu May 16 03:44:45 2019 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hR5Rs-0000CF-VQ for guile-devel@m.gmane.org; Thu, 16 May 2019 03:44:45 +0200 Original-Received: from localhost ([127.0.0.1]:46810 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR5Rr-0006jv-SG for guile-devel@m.gmane.org; Wed, 15 May 2019 21:44:43 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hR5R0-00067V-1E for guile-devel@gnu.org; Wed, 15 May 2019 21:43:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hR5Oo-0001S5-IV for guile-devel@gnu.org; Wed, 15 May 2019 21:41:35 -0400 Original-Received: from world.peace.net ([64.112.178.59]:46838) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hR5Oo-0001Rj-FM for guile-devel@gnu.org; Wed, 15 May 2019 21:41:34 -0400 Original-Received: from mhw by world.peace.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hR5On-0006Ob-14; Wed, 15 May 2019 21:41:33 -0400 In-Reply-To: (Amirouche Boubekki's message of "Tue, 14 May 2019 19:34:01 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.112.178.59 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.lisp.guile.devel:19923 Archived-At: Amirouche Boubekki writes: > I am stuck with a memory leak. I think gc-live-object-stats [0] would help. > > [0] https://www.gnu.org/software/guile/manual/html_node/Garbage-Collection-Functions.html#index-gc_002dlive_002dobject_002dstats > > Can some explain to me how to bring it back? I don't believe that libgc provides the necessary APIs to efficiently provide that old interface. You'd need to begin by learning libgc internals, and figure out what needs to be done. Then you'd need to convince the libgc developers to incorporate your changes. Two broad approaches that come to mind would be: (1) for libgc to keep a running count of the number of live objects of each type, incrementing the counts during allocations and decrementing them in the sweep phase, or (2) provide an interface to iterate over all live objects. In the latter case there'd be thread safety issues. Guile would also need modifications to tell libgc the types of the objects. Personally, I suggest finding another approach to debug your leak. I don't want to spend much time on this, because I suspect it would be a lot of work for questionable benefit, and it's not clear whether the result of that work will be acceptable to either libgc or Guile. It might introduce too much added complexity or overhead. Regards, Mark