Gnu-malloc, which is used by default, calls brk() and sbrk(). The OpenBSD
man page says about these functions:
"The brk and sbrk functions are historical curiosities left over from ear-
lier days before the advent of virtual memory management."
So I thought it might be a good idea to try --with-system-malloc. But
with this option the build fails with the following output, after building
all .elc files and dumping xemacs two times.
The machine is a Sun Sparc10 running OpenBSD 2.3. The patches for getting
it to configure and build with gnu-make are posted to the list in another
mail. The XEmacs source used here are 20.1b40, but 20.4 gives very similar
(if not the same) results. Using the default gnu-malloc gives a working
XEmacs.
Does the OpenBSD malloc find a memory leak in XEmacs here, or is something
else broken? Does system-malloc work on other systems?
Find the output of gmake, "xemacs -q", configure, and gdb below.
-hgw
gmake output:
--------------------------------------------------------------------
[...]
streams on free list: 2
stream storage: 198
Testing for Lisp shadows ...
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
gmake[2]: Leaving directory
`/usr/ports/editors/xemacs-beta/work/xemacs-21.0-b40/src'
gmake[1]: Leaving directory
`/usr/ports/editors/xemacs-beta/work/xemacs-21.0-b40/src'
Building finder database ...
xemacs in realloc(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
Lisp backtrace follows:
discard-input()
# bind (inhibit-quit debug-on-error etype error-object)
command-error((error "Memory exhausted"))
# (catch top-level ...)
Terminated
gmake: *** [lisp/finder-inf.el] Error 143
--------------------------------------------------------------------
Typing "./xemacs -q" gives a core dump (see below for gdb) and this
output:
--------------------------------------------------------------------
*** Error in XEmacs initialization
(invalid-regexp "Memory exhausted")
*** Backtrace
really-early-error-handler((invalid-regexp "Memory exhausted"))
string-match("\\`\\*?[-?*][^-]*[-?][^-]*[-?]\\([^-]*\\)[-?]\\([^-]?\\)[-?]\
\([
^-]*\\)[-?]\\([^-]*\\)[-?]\\(\\*\\|[0-9]+\\)[-?]\\(\\*\\|0\\|[0-9][0-9]+\\)
[-?]\
\([*0]\\|[0-9][0-9]+\\)[-?]\\([*0]\\|[0-9][0-9]+\\)[-?][cmp?*][-?]\\(\\*\\|
[0-9]
+\\)[-?][^-]*[-?][^-]+\\'" "normal")
# bind (which font)
x-frob-font-weight(#<font-instance "normal" on #<tty-device on
"stdio"
0x6c7>
0x6d1> "bold")
# bind (device font)
x-make-font-bold(#<font-instance "normal" on #<tty-device on
"stdio"
0x6c7> 0x
6d1> #<tty-device on "stdio" 0x6c7>)
# bind (inst sp locale func property face)
frob-face-property(bold font x-make-font-bold #<tty-device on "stdio"
0x6c7>)
#<compiled-function nil "...(26)" [featurep x frob-face-property face
font x-m
ake-font-bold locale mswindows mswindows-make-font-bold] 5>()
# bind (inst domain change-it specs the-locale standard-face-mapping
x-thunk t
ty-thunk frobbed-face unfrobbed-face locale face)
frob-face-font-2(bold #<tty-device on "stdio" 0x6c7> default bold
#<compiled-f
unction nil "...(12)" [featurep tty set-face-highlight-p face t locale]
5> #<com
piled-function nil "...(26)" [featurep x frob-face-property face font
x-make-fon
t-bold locale mswindows mswindows-make-font-bold] 5> (([default] .
[bold]) ([bol
d] . t) ([italic] . [bold-italic]) ([bold-italic] . t)))
# bind (locale face)
make-face-bold(bold #<tty-device on "stdio" 0x6c7>)
# bind (device)
init-other-random-faces(#<tty-device on "stdio" 0x6c7>)
# bind (device)
init-device-faces(#<tty-device on "stdio" 0x6c7>)
# (unwind-protect ...)
# (unwind-protect ...)
make-device(tty nil (terminal-type nil controlling-process nil))
# bind (controlling-process terminal-type tty)
make-tty-device(nil nil)
init-tty-win()
# bind (debugger debug-on-error command-line-args-left)
command-line()
# (unwind-protect ...)
normal-top-level()
# (condition-case ... . error)
# (catch top-level ...)
*** Killing XEmacs
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
xemacs in free(): warning: junk pointer, too high to make sense.
Fatal error: assertion failed, file device.h, line 217, RECORD_TYPEP
(_obj, lrecord_device) || MARKED_RECORD_P (_obj)
Fatal error: assertion failed, file device.h, line 217, RECORD_TYPEP
(_obj, lrecord_device) || MARKED_RECORD_P (_obj)
--------------------------------------------------------------------
configure --with-gnu-make --with-system-malloc:
--------------------------------------------------------------------
XEmacs 21.0-b40 "Saanen" configured for `sparc-unknown-openbsd2.3'.
Where should the build process find the source code?
/usr/ports/editors/xem
acs-beta/work/xemacs-21.0-b40
What installation prefix should install use? /usr/local
What operating system and machine description files should XEmacs use?
`s/openbsd.h' and `m/sparc.h'
What compiler should XEmacs be built with? gcc -g -O2
-Wall -Wno-switch
Should XEmacs use the GNU version of malloc? no
(User chose not to use GNU allocators).
Should XEmacs use the relocating allocator for buffers? yes
What window system should XEmacs use? x11
Where do we find X Windows header files?
/usr/X11R6/include
Where do we find X Windows libraries? /usr/X11R6/lib
Compiling in support for XAUTH.
--------------------------------------------------------------------
WARNING: Compiling without XPM support.
WARNING: You should strongly considering installing XPM.
WARNING: Otherwise toolbars and other graphics will look suboptimal.
--------------------------------------------------------------------
Compiling in support for Berkeley DB.
Compiling in support for GNU DBM.
Compiling in support for OffiX.
Compiling in support for Drag'n'Drop ( OffiX ).
Compiling in support for proper session-management.
Using Lucid menubars.
Using Lucid scrollbars.
Using Athena dialog boxes.
Compiling in DLL support.
movemail will use "flock" for locking mail spool files.
Compiling in extra code for debugging.
Compiling in code for checking XEmacs memory usage.
WARNING: ---------------------------------------------------------
WARNING: Compiling in support for runtime error checking.
WARNING: XEmacs will run noticeably more slowly as a result.
WARNING: Error checking is on by default for XEmacs beta releases.
WARNING: ---------------------------------------------------------
--------------------------------------------------------------------
GDB:
--------------------------------------------------------------------
sparc:src {62} gdb xemacs xemacs.core
GNU gdb 4.16.1
Copyright 1996 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for
details.
This GDB was configured as "sparc-unknown-openbsd2.3"...
Core was generated by `xemacs'.
Program terminated with signal 6, Abort trap.
Reading symbols from /usr/libexec/ld.so...done.
Reading symbols from /usr/X11R6/lib/libXaw.so.6.1...done.
Reading symbols from /usr/lib/libz.so.1.2...done.
Reading symbols from /usr/X11R6/lib/libXmu.so.6.0...done.
Reading symbols from /usr/X11R6/lib/libXt.so.6.0...done.
Reading symbols from /usr/X11R6/lib/libXext.so.6.3...done.
Reading symbols from /usr/X11R6/lib/libX11.so.6.1...done.
Reading symbols from /usr/X11R6/lib/libSM.so.6.0...done.
Reading symbols from /usr/X11R6/lib/libICE.so.6.3...done.
Reading symbols from /usr/lib/libtermcap.so.0.0...done.
Reading symbols from /usr/lib/libkvm.so.5.1...done.
Reading symbols from /usr/lib/libm.so.0.1...done.
Reading symbols from /usr/lib/libc.so.18.0...done.
#0 0x44480ac in abort ()
(gdb) bt
#0 0x44480ac in abort ()
#1 0x51e74 in assert_failed (file=0x955e8 "\021", line=217,
expr=0x955f8 "\021") at emacs.c:2586
#2 0x98fd8 in reset_tty_modes (c=0xa0306004) at device.h:217
#3 0x19c8cc in tty_reset_sys_modes_on_device (d=0x3d7c00) at
sysdep.c:1899
#4 0x19c954 in reset_one_device (d=0x3d1100) at sysdep.c:1934
#5 0x19cb3c in reset_one_console (con=0x4038a264) at sysdep.c:1958
#6 0x19cc58 in reset_all_consoles () at sysdep.c:1972
#7 0x516c8 in shut_down_emacs (sig=6, stuff=-1607442428) at emacs.c:2225
#8 0x4eeec in fatal_error_signal (sig=6) at emacs.c:243
#9 0xf7ffff74 in ?? ()
#10 0x44480ac in abort ()
#11 0x45008 in emacs_doprnt_string_lisp_2 (format_nonreloc=0x76 "",
format_reloc=611816, format_length=217, nargs=611832) at lstream.h:33
#12 0x51e74 in assert_failed (file=0x955e8 "\021", line=217,
expr=0x955f8 "\021") at emacs.c:2586
#13 0x98fd8 in reset_tty_modes (c=0xa0306004) at device.h:217
#14 0x19c8cc in tty_reset_sys_modes_on_device (d=0x3d7c00) at
sysdep.c:1899
#15 0x19c954 in reset_one_device (d=0x3d1100) at sysdep.c:1934
#16 0x3b4dc in delete_device_internal (d=0x3d1100, force=1,
called_from_delete_console=1, from_io_error=0) at device.c:726
#17 0x2ca10 in delete_console_internal (con=0x3d7c00, force=268435455,
called_from_kill_emacs=1077453412, from_io_error=0) at console.c:674
#18 0x51248 in Fkill_emacs (arg=268435455) at emacs.c:2157
#19 0x26c60 in Freally_early_error_handler (x=1077890956) at cmdloop.c:128
#20 0x59348 in funcall_recording_as (recorded_as=539155952, nargs=1,
args=0xf7ffb6f8) at eval.c:3197
#21 0x5959c in Ffuncall (nargs=2, args=0xf7ffb6f8) at eval.c:3238
#22 0x5afa4 in call1 (fn=-1607364756, arg0=1077890956) at eval.c:3912
#23 0x56864 in signal_1 (sig=-1607333476, data=1077890940) at eval.c:1907
#24 0x56b3c in Fsignal (error_symbol=-1607333476, data=1077890940)
at eval.c:2044
#25 0x56fb4 in maybe_signal_error (sig=-1607333476, data=1077890940,
class=-1607342276, errb=Cannot access memory at address 0x29a.
) at eval.c:2196
#26 0x177b6c in compile_pattern_1 (cp=0x0, pattern=1613524928,
translate=0x16d388 "@\002gIR\006`\004\222\222 ", regp=0x2d9d78,
posix=0,
errb=Cannot access memory at address 0x29a.
) at search.c:149
#27 0x177bf8 in compile_pattern (pattern=1613524928, regp=0x2d9d78,
translate=0x302c44 "", posix=0, errb=Cannot access memory at address
0x29a.
) at search.c:186
#28 0x1782e0 in string_match_1 (regexp=1613524928, string=1613857948,
start=-1607442428, buf=0x323c00, posix=0) at search.c:390
#29 0x178430 in Fstring_match (regexp=1613524928, string=1613857948,
start=-1607442428, buffer=-1607442428) at search.c:421
#30 0x59240 in funcall_recording_as (recorded_as=539831176, nargs=2,
args=0xf7ffbd60) at eval.c:3193
#31 0x5959c in Ffuncall (nargs=3, args=0xf7ffbd60) at eval.c:3238
#32 0x1be10 in Fbyte_code (bytestr=1613525804, vector=-2144570504,
maxdepth=3009536) at bytecode.c:416
#33 0x5a8d8 in funcall_lambda (fun=539784108, nargs=2,
arg_vector=0xf7ffc0d0)
at eval.c:3597
#34 0x5953c in funcall_recording_as (recorded_as=539784108, nargs=2,
args=0xf7ffc0cc) at eval.c:3214
#35 0x5959c in Ffuncall (nargs=3, args=0xf7ffc0cc) at eval.c:3238
#36 0x1be10 in Fbyte_code (bytestr=1613526336, vector=-2144570008,
maxdepth=3009536) at bytecode.c:416
#37 0x5a8d8 in funcall_lambda (fun=539784608, nargs=2,
arg_vector=0xf7ffc564)
at eval.c:3597
#38 0x5953c in funcall_recording_as (recorded_as=539784608, nargs=2,
args=0xf7ffc560) at eval.c:3214
#39 0x5959c in Ffuncall (nargs=3, args=0xf7ffc560) at eval.c:3238
#40 0x1be10 in Fbyte_code (bytestr=1613115928, vector=-2144980340,
maxdepth=3009536) at bytecode.c:416
#41 0x5a8d8 in funcall_lambda (fun=539374368, nargs=4,
arg_vector=0xf7ffc8dc)
at eval.c:3597
#42 0x5953c in funcall_recording_as (recorded_as=539374368, nargs=4,
args=0xf7ffc8d8) at eval.c:3214
#43 0x5959c in Ffuncall (nargs=5, args=0xf7ffc8d8) at eval.c:3238
#44 0x1be10 in Fbyte_code (bytestr=1613117376, vector=-2144978968,
maxdepth=3009536) at bytecode.c:416
#45 0x5a8d8 in funcall_lambda (fun=539375632, nargs=0,
arg_vector=0xf7ffcec4)
at eval.c:3597
#46 0x5953c in funcall_recording_as (recorded_as=539375632, nargs=0,
args=0xf7ffcec0) at eval.c:3214
#47 0x5959c in Ffuncall (nargs=1, args=0xf7ffcec0) at eval.c:3238
#48 0x1be10 in Fbyte_code (bytestr=1613116784, vector=-2144979404,
maxdepth=3009536) at bytecode.c:416
#49 0x5a8d8 in funcall_lambda (fun=539375340, nargs=7,
arg_vector=0xf7ffd204)
at eval.c:3597
#50 0x5953c in funcall_recording_as (recorded_as=539375340, nargs=7,
args=0xf7ffd200) at eval.c:3214
#51 0x5959c in Ffuncall (nargs=8, args=0xf7ffd200) at eval.c:3238
#52 0x1be10 in Fbyte_code (bytestr=1613117508, vector=-2144978784,
maxdepth=3009536) at bytecode.c:416
#53 0x5a8d8 in funcall_lambda (fun=539375924, nargs=2,
arg_vector=0xf7ffd804)
at eval.c:3597
#54 0x5953c in funcall_recording_as (recorded_as=539375924, nargs=2,
args=0xf7ffd800) at eval.c:3214
#55 0x5959c in Ffuncall (nargs=3, args=0xf7ffd800) at eval.c:3238
#56 0x1be10 in Fbyte_code (bytestr=1613126268, vector=-2144969916,
maxdepth=3009536) at bytecode.c:416
#57 0x5a8d8 in funcall_lambda (fun=539384776, nargs=1,
arg_vector=0xf7ffdbf4)
at eval.c:3597
#58 0x5953c in funcall_recording_as (recorded_as=539384776, nargs=1,
args=0xf7ffdbf0) at eval.c:3214
#59 0x5959c in Ffuncall (nargs=2, args=0xf7ffdbf0) at eval.c:3238
#60 0x1be10 in Fbyte_code (bytestr=1613125036, vector=-2144971280,
maxdepth=3009536) at bytecode.c:416
#61 0x5a8d8 in funcall_lambda (fun=539383332, nargs=1,
arg_vector=0xf7ffdf00)
at eval.c:3597
#62 0x5953c in funcall_recording_as (recorded_as=539383332, nargs=1,
args=0xf7ffdefc) at eval.c:3214
#63 0x5959c in Ffuncall (nargs=2, args=0xf7ffdefc) at eval.c:3238
#64 0x564c8 in Fcall_with_condition_handler (nargs=3, args=0xf7ffdef8)
at eval.c:1794
#65 0x5b5a4 in call1_with_handler (handler=-1607364756, fn=-1607350996,
arg0=540872960) at eval.c:4189
#66 0x3da54 in call_critical_lisp_code (d=0x3d1100, function=-1607350996,
object=540872960) at device.c:1203
#67 0xcd2d4 in init_device_faces (d=0x3d1100) at faces.c:883
#68 0x39fe0 in init_device_resources (d=0x3d1100) at device.c:375
#69 0x3aa24 in Fmake_device (type=4029440, connection=-1607442428,
props=1077890524) at device.c:592
#70 0x59374 in funcall_recording_as (recorded_as=539159728, nargs=3,
args=0xf7ffe300) at eval.c:3197
#71 0x5959c in Ffuncall (nargs=4, args=0xf7ffe300) at eval.c:3238
#72 0x1be10 in Fbyte_code (bytestr=1613089412, vector=-2145006948,
maxdepth=3009536) at bytecode.c:416
#73 0x5a8d8 in funcall_lambda (fun=539347632, nargs=2,
arg_vector=0xf7ffe66c)
at eval.c:3597
#74 0x5953c in funcall_recording_as (recorded_as=539347632, nargs=2,
args=0xf7ffe668) at eval.c:3214
#75 0x5959c in Ffuncall (nargs=3, args=0xf7ffe668) at eval.c:3238
#76 0x1be10 in Fbyte_code (bytestr=1613567612, vector=-2144528736,
maxdepth=3009536) at bytecode.c:416
#77 0x5a8d8 in funcall_lambda (fun=539825856, nargs=0,
arg_vector=0xf7ffeaf4)
at eval.c:3597
#78 0x5953c in funcall_recording_as (recorded_as=539825856, nargs=0,
args=0xf7ffeaf0) at eval.c:3214
#79 0x5959c in Ffuncall (nargs=1, args=0xf7ffeaf0) at eval.c:3238
#80 0x1be10 in Fbyte_code (bytestr=1613263848, vector=-2144832424,
maxdepth=3009536) at bytecode.c:416
#81 0x5a8d8 in funcall_lambda (fun=539522332, nargs=0,
arg_vector=0xf7fff09c)
at eval.c:3597
#82 0x5953c in funcall_recording_as (recorded_as=539522332, nargs=0,
args=0xf7fff098) at eval.c:3214
#83 0x5959c in Ffuncall (nargs=1, args=0xf7fff098) at eval.c:3238
#84 0x1be10 in Fbyte_code (bytestr=1613261904, vector=-2144834296,
maxdepth=3009536) at bytecode.c:416
#85 0x5a8d8 in funcall_lambda (fun=539520736, nargs=0,
arg_vector=0xf7fff230)
at eval.c:3597
#86 0x5a078 in apply_lambda (fun=539520736, numargs=3001344,
unevalled_args=-1607442428) at eval.c:3501
#87 0x58e38 in Feval (form=1077178460) at eval.c:3085
#88 0x561d0 in condition_case_1 (handlers=2979840, bfun=0x582d8 <Feval>,
barg=1077178460, hfun=0x26c68 <cmd_error>, harg=-1607442428) at
eval.c:1653
#89 0x26d20 in top_level_1 (dummy=-1607442428) at cmdloop.c:206
#90 0x55d24 in internal_catch (tag=-1607364732, func=0x26ce8
<top_level_1>,
arg=-1607442428, threw=0x0) at eval.c:1328
#91 0x26e64 in initial_command_loop (load_me=158952) at cmdloop.c:285
#92 0x50518 in xemacs_21_0_b40_sparc_unknown_openbsd2_3 (argc=2,
argv=0xf7fff894, envp=0xf7fff8a0, restart=3010204) at emacs.c:1683
#93 0x5109c in main (argc=0, argv=0xf7fff894, envp=0xf7fff8a0) at
emacs.c:2100