From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#22737: 25.1; Finalizer should be optional in dynamic modules Date: Fri, 19 Feb 2016 11:33:55 +0200 Message-ID: <83lh6hrqm4.fsf@gnu.org> References: <87a8mxsn2g.fsf@oracle.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1455874522 9998 80.91.229.3 (19 Feb 2016 09:35:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 19 Feb 2016 09:35:22 +0000 (UTC) Cc: 22737@debbugs.gnu.org To: Jess Balint Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Feb 19 10:35:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1aWhSv-0001A5-NE for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Feb 2016 10:35:09 +0100 Original-Received: from localhost ([::1]:50401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWhSv-0004iS-3u for geb-bug-gnu-emacs@m.gmane.org; Fri, 19 Feb 2016 04:35:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52447) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWhSr-0004gz-PA for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2016 04:35:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWhSo-0000Nl-I9 for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2016 04:35:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWhSo-0000Nf-EW for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2016 04:35:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aWhSo-0001Fq-7O for bug-gnu-emacs@gnu.org; Fri, 19 Feb 2016 04:35:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 19 Feb 2016 09:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22737 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22737-submit@debbugs.gnu.org id=B22737.14558744504755 (code B ref 22737); Fri, 19 Feb 2016 09:35:02 +0000 Original-Received: (at 22737) by debbugs.gnu.org; 19 Feb 2016 09:34:10 +0000 Original-Received: from localhost ([127.0.0.1]:33500 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aWhRy-0001Ed-I2 for submit@debbugs.gnu.org; Fri, 19 Feb 2016 04:34:10 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:32966) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aWhRw-0001EP-Rq for 22737@debbugs.gnu.org; Fri, 19 Feb 2016 04:34:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aWhRo-00009U-IH for 22737@debbugs.gnu.org; Fri, 19 Feb 2016 04:34:03 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42961) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aWhRo-00009M-FM; Fri, 19 Feb 2016 04:34:00 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2868 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aWhRn-0000Rv-LD; Fri, 19 Feb 2016 04:34:00 -0500 In-reply-to: <87a8mxsn2g.fsf@oracle.com> (message from Jess Balint on Thu, 18 Feb 2016 15:52:55 -0600) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113282 Archived-At: > From: Jess Balint > Date: Thu, 18 Feb 2016 15:52:55 -0600 > > Dynamic modules are really cool so far, but I think finalizers should > not be mandatory for user pointers (alloc.c): > > #ifdef HAVE_MODULES > else if (mblk->markers[i].m.u_any.type == Lisp_Misc_User_Ptr) > { > struct Lisp_User_Ptr *uptr = &mblk->markers[i].m.u_user_ptr; > uptr->finalizer (uptr->p); <----- should NULL-check first > } > #endif > > c.f. https://github.com/emacs-mirror/emacs/blob/master/src/alloc.c#L6893 Can you tell more about the use case where you needed this change? A user-pointer holds a pointer to some unspecified data, and that data needs to be free'd when the user-pointer object is GC'ed; failure to do so will cause memory leaks. When is the above incorrect, or gets in your way? Thanks.