Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!ALLSPICE.LCS.MIT.EDU!shep From: shep@ALLSPICE.LCS.MIT.EDU (Tim Shepard) Newsgroups: gnu.emacs.bug Subject: emacs memory use limitation Message-ID: <8907091551.AA02292@PTT.LCS.MIT.EDU> Date: 9 Jul 89 15:51:44 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 109 I'm using emacs-18.54 on a BSD4.3 VAX. As distributed, emacs can only use the first 16 megabytes of data memory on most architectures. This is because VALBITS is defined to be 24 in lisp.h and only the low VALBITS bits of a pointer are actually saved. The upper 8 bits are quietly ignored. This causes emacs to become very confused when malloc() starts returning pointers which do not fit in 24 bits. If you've seen a looping and unresponsive emacs which ps shows to be about 16 or 17 megabytes big, then you've likely been bitten by this. The malloc distributed with emacs does check to make sure you have not exceeded the BSD {get,set}rlimit() imposed memory limits and does invoke callback routines to the program to warn of the approaching exhaustion of memory. Emacs does use these callbacks to show the user the *Danger* buffers, but neither emacs nor the emacs malloc() checks to make sure that the pointers have not exceeded this 16 megabyte limit. I quickly made the changes shown in the diff below to the emacs malloc.c which in my particular case (BSD4.3, Vax) causes malloc to make sure the pointers will be usable by emacs and uses (1< (1 << VALBITS)) || ! #endif ! #endif ! #endif ! ((cp = sbrk (1 << (siz + 3))) == (char *) -1) ! ) { #ifdef BSD #ifndef BSD4_1 *************** *** 792,797 **** --- 802,815 ---- get_lim_data () { lim_data = vlimit (LIM_DATA, -1); + #ifdef emacs + #ifdef vax + #ifdef VALBITS + if ((1<