unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* cygwin emacs gtk2 problem fix
@ 2008-07-07  0:32 d.henman
  0 siblings, 0 replies; 3+ messages in thread
From: d.henman @ 2008-07-07  0:32 UTC (permalink / raw)
  To: emacs-devel


I have found a simple fix to for the cygwin emacs gtk2 problem, as mentioned in the etc/PROBLEM file.  I do not have, the proper status to change the cvs files, so I am presenting this patch for the etc/PROBLEM file.   The patch below describes my fix fo
r the gtk2 emacs crash problem on startup, due to failure to allocate memory.

Regards,
  Darel Henman

For reference, this fix works on my machine which uses the following gtk2 elements and cygwin version:

glib-2.16.4  , atk-1.9.0 , pixman-0.11.4 , cairo-1.6.4 , pango-1.21.3 , gtk+-2.12.11
CYGWIN_NT-5.1 1.5.25(0.156/4/2) 2008-06-12
compiled with: gcc (GCC) 4.3.2 20080619 (prerelease)

 ================ submitted patch for etc/PROBLEMS file follows ================
--- emacs/etc/PROBLEMS
+++ modified-20080707
@@ -233,7 +233,7 @@
 This happens because of bugs in Gtk+.  Gtk+ 2.10 seems to be OK.  See bug
 http://bugzilla.gnome.org/show_bug.cgi?id=85715.
 
-** Emacs compiled with Gtk+ crashes on startup on Cygwin.
+** Emacs compiled with Gtk+ crashes on startup from Cygwin's X11 window.
 
 A typical error message is
   ***MEMORY-ERROR***: emacs[5172]: GSlice: failed to allocate 504 bytes
@@ -241,8 +241,18 @@
 
 Emacs supplies its own malloc, but glib (part of Gtk+) calls memalign and on
 Cygwin, that becomes the Cygwin supplied memalign.  As malloc is not the
-Cygwin malloc, the Cygwin memalign always returns ENOSYS.  A fix for this
-problem would be welcome.
+Cygwin malloc, the Cygwin memalign always returns ENOSYS. 
+
+A fix for this, that worked for me, involves setting the G_SLICE environment
+variable, which allows reconfiguration of the GSlice memory allocator.  It is 
+convenient to do this in your X11's $HOME/.xinitrc file as follows, before any
+"exec emacs &" line in the file, if you have any:
+
+export G_SLICE=always-malloc 
+
+This fix can be easily tested on a cygwin x-window command line by typing:
+  $ export G_SLICE=always-malloc 
+  $ emacs
 
 * General runtime problems
 
 ================ end of submitted etc/PROBLEMS patch ================





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cygwin emacs gtk2 problem fix
@ 2008-07-07 22:41 Angelo Graziosi
  2008-07-08  3:03 ` d.henman
  0 siblings, 1 reply; 3+ messages in thread
From: Angelo Graziosi @ 2008-07-07 22:41 UTC (permalink / raw)
  To: d.henman; +Cc: eliz, emacs-devel

d.henman wrote:

 > I have found a simple fix to for the cygwin emacs gtk2 problem,
 > as mentioned in the etc/PROBLEM file.
 > [...]
 >
 > +  $ export G_SLICE=always-malloc
 > +  $ emacs

Confirmed. It works just fine!

Now the question is: could that be done at level of source code?


Cheers,
    Angelo.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: cygwin emacs gtk2 problem fix
  2008-07-07 22:41 cygwin emacs gtk2 problem fix Angelo Graziosi
@ 2008-07-08  3:03 ` d.henman
  0 siblings, 0 replies; 3+ messages in thread
From: d.henman @ 2008-07-08  3:03 UTC (permalink / raw)
  To: emacs-devel; +Cc: eliz, Angelo Graziosi


Thanks for the confirmation that the fix works for you as well.

As to your question:
"> Now the question is: could that be done at level of source code?"

I am not familiar with the source code, though I did try something like the following in "../lisp/startup.el", thinking it might work.

Ideally I7d use the below (if (and ...)) structure, but I don't now how to determine the toolkit emacs was built with.  I simply wrote "x-toolkit" to illustrate.

(if (and (string= system-type "cygwin") (string= x-toolkit "gtk2"))
    	(setenv "G_SLICE" "always-malloc"))

but, since I don't know how to find the toolkit used I just used the below:
(if (string= system-type "cygwin")
    	(setenv "G_SLICE" "always-malloc"))

But, this did not work. emacs just crashed.  I guess startup.el is called after doing some processing with the toolkit.

Regards,
  Darel Henman


Angelo Graziosi <angelo.graziosi@alice.it> wrote:
> d.henman wrote:
> 
> > I have found a simple fix to for the cygwin emacs gtk2 problem,
> > as mentioned in the etc/PROBLEM file.
> > [...]
> >
> > +  $ export G_SLICE=always-malloc
> > +  $ emacs
> 
> Confirmed. It works just fine!
> 
> Now the question is: could that be done at level of source code?
> 
> 
> Cheers,
>    Angelo.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-08  3:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-07 22:41 cygwin emacs gtk2 problem fix Angelo Graziosi
2008-07-08  3:03 ` d.henman
  -- strict thread matches above, loose matches on Subject: below --
2008-07-07  0:32 d.henman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).