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, 26 Feb 2016 20:36:34 +0200

> Date: Fri, 26 Feb 2016 10:17:26 -0600
> From: Jess Balint <jbalint@gmail.com>
> Cc: 22737@debbugs.gnu.org
> 
> Situation #1 - globals:
> 
> I have pointers to data that are global (not on the heap). I return these 
> pointers from module functions so that
> they may be used as parameters to other module function calls. These pointers 
> should *never* be freed. In
> this case I need to supply a no-op finalizer when creating the user pointer.
> 
> Situation #2 - manual memory management:
> 
> I have heap-allocated structures whose memory should not be managed by Emacs. 
> I may return pointers to
> this data one or many times from module calls. The data should be freed only 
> when explicitly requested. I may
> return many user pointers to the same heap-allocated structure. Even when all 
> these are freed by Emacs, I
> still retain a pointer in my module which may be returned in a future module 
> call. Again, I'm required to supply
> a no-op finalizer when creating these user pointers.

What will happen if such objects are exposed to Lisp, copied or
assigned to other Lisp variables, etc.?  Won't this cause all kinds of
trouble, like modifying one such object will magically modify several
others, which share its storage?





reply via email to

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