GNU bug report logs -
#22737
25.1; Finalizer should be optional in dynamic modules
Previous Next
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
[Message part 1 (text/plain, inline)]
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.
Thanks.
Jess
On Tue, Feb 23, 2016 at 9:40 PM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> > Date: Tue, 23 Feb 2016 16:47:12 -0600
> > From: Jess Balint <jbalint <at> gmail.com>
> > Cc: 22737 <at> debbugs.gnu.org
> >
> > 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.
>
> I don't think I follow. How can you manage memory manually when Emacs
> does GC whenever it feels like it? The memory of the objects it GCs
> will simply be leaked if you don't have a finalizer.
>
> Can you describe a specific use case where a finalizer would not be
> needed?
>
> 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.