From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andy Wingo Subject: Re: (guix git) and guile-git finalizers. Date: Thu, 22 Jun 2017 13:40:06 +0200 Message-ID: <87fues6yjt.fsf@igalia.com> References: <86h8zliddr.fsf@gmail.com> <87zidc2thj.fsf@gnu.org> <86vans0xws.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dO0To-0005N5-OB for guix-devel@gnu.org; Thu, 22 Jun 2017 07:40:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dO0Tj-0006XX-RA for guix-devel@gnu.org; Thu, 22 Jun 2017 07:40:56 -0400 In-Reply-To: <86vans0xws.fsf@gmail.com> (Mathieu Othacehe's message of "Mon, 19 Jun 2017 18:01:23 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Mathieu Othacehe Cc: guix-devel , Amirouche Hi :) Just some code review. On Mon 19 Jun 2017 18:01, Mathieu Othacehe writes: > The idea here is to create a guardian per pointer-type to finalize. A > pumper function that operates on this guardian is also created. This > pumper function knows the git_libgit2_xxx function to call to free the > pointers stored in guardians. Neat. A couple problems though. (1) All finalizable objects will be kept alive until they are removed from the guardian. With guardians, you usually want to incrementally visit it during program execution: say, every time you allocate a new repository object. Or via after-gc-hook. (2) Whether an object is visible in the guardian is not a very deterministic property. It won't be returned from a guardian until all other references are gone, but there's no guarantee about when it will be returned -- depends on GC and many other factors. So it's possible that repository objects are still "alive" after you shut down libgit. Why do you feel the need to "shut down" libgit? Honestly I would punt. Most other libraries aren't like that. Andy