|
From: | Ken Raeburn |
Subject: | Re: address@hidden: Re: emacs-22.1 with GTK dumps core when Gnome wigets clicked] |
Date: | Mon, 25 Jun 2007 05:30:14 -0400 |
On Jun 25, 2007, at 04:30, YAMAMOTO Mitsuharu wrote:
Nor is this change guaranteed to cause there to be only one access to "__malloc_hook", unless you change it to be declared volatile. (And, in fact, if you're optimizing, I would've expected it to be only one access in the original code on nearly all platforms.)As a matter of fact, the original code caused a real problem:http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-06/ msg00170.html
I'd believe it could be, sure. But if that code were produced with gcc -O2, I'd be disappointed. Other compilers ... eh, some of them aren't that good. :-)
Mutex protection around accesses to the hook variable would be the safest (and wouldn't require temporary variables or volatile qualifiers), though performance would not be as good.Temporary variables will be necessary so that we can unlock the mutex before the actual call to the hook. We also need to add some special functions to change the hook variables and use them instead of assignments to the hook variables in alloc.c. That's why I said that "malloc in glibc 2.5 also does the same thing and I suspect that we cannot do better as long as we try to keep the same interface with respect to __malloc_hook etc." in http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg01503.html
Yes, I think keeping the current glibc interface -- at least, as the one we actually use -- seems like a poor idea. Though the change should be coordinated with glibc maintainers, of course.
Ken
[Prev in Thread] | Current Thread | [Next in Thread] |