GNU bug report logs - #22737
25.1; Finalizer should be optional in dynamic modules

Previous Next

Package: emacs;

Reported by: Jess Balint <jbalint <at> gmail.com>

Date: Thu, 18 Feb 2016 21:58:02 UTC

Severity: normal

Tags: notabug, wontfix

Found in version 25.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jess Balint <jbalint <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 22737 <at> debbugs.gnu.org
Subject: bug#22737: 25.1; Finalizer should be optional in dynamic modules
Date: Tue, 23 Feb 2016 16:47:12 -0600
[Message part 1 (text/plain, inline)]
If the data is unspecified it doesn't *necessarily* need to be freed. If I
return a pointer to some global data then I need to create a no-op
finalizer just to please this GC code. In some cases I will be managing
memory a bit more manually and don't care to have Emacs doing anything for
me.

Thx.

Jess

On Fri, Feb 19, 2016 at 3:33 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Jess Balint <jbalint <at> gmail.com>
> > 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.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 5 years and 316 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.