bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#22737: 25.1; Finalizer should be optional in dynamic modules


From: Eli Zaretskii
Subject: bug#22737: 25.1; Finalizer should be optional in dynamic modules
Date: Fri, 19 Feb 2016 11:33:55 +0200

> From: Jess Balint <address@hidden>
> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]