1 Copyright 1988, 1989 Hans-J. Boehm, Alan J. Demers
2 Copyright (c) 1991-1996 by Xerox Corporation. All rights reserved.
3 Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
4 Copyright (c) 1999 by Hewlett-Packard Company. All rights reserved.
6 [ This version of the collector modified for use in libgcj.
7 See the file ChangeLog for details ]
9 THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
10 OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
12 Permission is hereby granted to use or copy this program
13 for any purpose, provided the above notices are retained on all copies.
14 Permission to modify the code and to distribute modified code is granted,
15 provided the above notices are retained, and a notice that the code was
16 modified is included with the above copyright notice.
18 This is version 5.1 of a conservative garbage collector for C and C++.
20 You might find a more recent version of this at
22 http://www.hpl.hp.com/personal/Hans_Boehm/gc
26 Early versions of this collector were developed as a part of research
27 projects supported in part by the National Science Foundation
28 and the Defense Advance Research Projects Agency.
29 Much of the code was rewritten by Hans-J. Boehm (boehm@acm.org) at Xerox PARC,
32 Some other contributors:
34 More recent contributors are mentioned in the modification history at the
35 end of this file. My apologies for any omissions.
37 The SPARC specific code was contributed by Mark Weiser
38 (weiser@parc.xerox.com). The Encore Multimax modifications were supplied by
39 Kevin Kenny (kenny@m.cs.uiuc.edu). The adaptation to the RT is largely due
40 to Vernon Lee (scorpion@rice.edu), on machines made available by IBM.
41 Much of the HP specific code and a number of good suggestions for improving the
42 generic code are due to Walter Underwood (wunder@hp-ses.sde.hp.com).
43 Robert Brazile (brazile@diamond.bbn.com) originally supplied the ULTRIX code.
44 Al Dosser (dosser@src.dec.com) and Regis Cridlig (Regis.Cridlig@cl.cam.ac.uk)
45 subsequently provided updates and information on variation between ULTRIX
46 systems. Parag Patel (parag@netcom.com) supplied the A/UX code.
47 Jesper Peterson(jep@mtiame.mtia.oz.au), Michel Schinz, and
48 Martin Tauchmann (martintauchmann@bigfoot.com) supplied the Amiga port.
49 Thomas Funke (thf@zelator.in-berlin.de(?)) and
50 Brian D.Carlstrom (bdc@clark.lcs.mit.edu) supplied the NeXT ports.
51 Douglas Steel (doug@wg.icl.co.uk) provided ICL DRS6000 code.
52 Bill Janssen (janssen@parc.xerox.com) supplied the SunOS dynamic loader
53 specific code. Manuel Serrano (serrano@cornas.inria.fr) supplied linux and
54 Sony News specific code. Al Dosser provided Alpha/OSF/1 code. He and
55 Dave Detlefs(detlefs@src.dec.com) also provided several generic bug fixes.
56 Alistair G. Crooks(agc@uts.amdahl.com) supplied the NetBSD and 386BSD ports.
57 Jeffrey Hsu (hsu@soda.berkeley.edu) provided the FreeBSD port.
58 Brent Benson (brent@jade.ssd.csd.harris.com) ported the collector to
59 a Motorola 88K processor running CX/UX (Harris NightHawk).
60 Ari Huttunen (Ari.Huttunen@hut.fi) generalized the OS/2 port to
61 nonIBM development environments (a nontrivial task).
62 Patrick Beard (beard@cs.ucdavis.edu) provided the initial MacOS port.
63 David Chase, then at Olivetti Research, suggested several improvements.
64 Scott Schwartz (schwartz@groucho.cse.psu.edu) supplied some of the
65 code to save and print call stacks for leak detection on a SPARC.
66 Jesse Hull and John Ellis supplied the C++ interface code.
67 Zhong Shao performed much of the experimentation that led to the
68 current typed allocation facility. (His dynamic type inference code hasn't
69 made it into the released version of the collector, yet.)
70 (Blame for misinstallation of these modifications goes to the first author,
75 This is intended to be a general purpose, garbage collecting storage
76 allocator. The algorithms used are described in:
78 Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
79 Software Practice & Experience, September 1988, pp. 807-820.
81 Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection",
82 Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design
83 and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164.
85 Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings
86 of the ACM SIGPLAN '91 Conference on Programming Language Design and
87 Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206.
89 Possible interactions between the collector and optimizing compilers are
92 Boehm, H., and D. Chase, "A Proposal for GC-safe C Compilation",
93 The Journal of C Language Translation 4, 2 (December 1992).
97 Boehm H., "Simple GC-safe Compilation", Proceedings
98 of the ACM SIGPLAN '96 Conference on Programming Language Design and
101 (Both are also available from
102 http://reality.sgi.com/boehm/papers/, among other places.)
104 Unlike the collector described in the second reference, this collector
105 operates either with the mutator stopped during the entire collection
106 (default) or incrementally during allocations. (The latter is supported
107 on only a few machines.) It does not rely on threads, but is intended
110 Some of the ideas underlying the collector have previously been explored
111 by others. (Doug McIlroy wrote a vaguely similar collector that is part of
112 version 8 UNIX (tm).) However none of this work appears to have been widely
115 Rudimentary tools for use of the collector as a leak detector are included, as
116 is a fairly sophisticated string package "cord" that makes use of the collector.
122 This is a garbage collecting storage allocator that is intended to be
123 used as a plug-in replacement for C's malloc.
125 Since the collector does not require pointers to be tagged, it does not
126 attempt to ensure that all inaccessible storage is reclaimed. However,
127 in our experience, it is typically more successful at reclaiming unused
128 memory than most C programs using explicit deallocation. Unlike manually
129 introduced leaks, the amount of unreclaimed memory typically stays
132 In the following, an "object" is defined to be a region of memory allocated
133 by the routines described below.
135 Any objects not intended to be collected must be pointed to either
136 from other such accessible objects, or from the registers,
137 stack, data, or statically allocated bss segments. Pointers from
138 the stack or registers may point to anywhere inside an object.
139 The same is true for heap pointers if the collector is compiled with
140 ALL_INTERIOR_POINTERS defined, as is now the default.
142 Compiling without ALL_INTERIOR_POINTERS may reduce accidental retention
143 of garbage objects, by requiring pointers from the heap to to the beginning
144 of an object. But this no longer appears to be a significant
145 issue for most programs.
147 There are a number of routines which modify the pointer recognition
148 algorithm. GC_register_displacement allows certain interior pointers
149 to be recognized even if ALL_INTERIOR_POINTERS is nor defined.
150 GC_malloc_ignore_off_page allows some pointers into the middle of large objects
151 to be disregarded, greatly reducing the probablility of accidental
152 retention of large objects. For most purposes it seems best to compile
153 with ALL_INTERIOR_POINTERS and to use GC_malloc_ignore_off_page if
154 you get collector warnings from allocations of very large objects.
155 See README.debugging for details.
157 Note that pointers inside memory allocated by the standard "malloc" are not
158 seen by the garbage collector. Thus objects pointed to only from such a
159 region may be prematurely deallocated. It is thus suggested that the
160 standard "malloc" be used only for memory regions, such as I/O buffers, that
161 are guaranteed not to contain pointers to garbage collectable memory.
162 Pointers in C language automatic, static, or register variables,
163 are correctly recognized. (Note that GC_malloc_uncollectable has semantics
164 similar to standard malloc, but allocates objects that are traced by the
167 The collector does not always know how to find pointers in data
168 areas that are associated with dynamic libraries. This is easy to
169 remedy IF you know how to find those data areas on your operating
170 system (see GC_add_roots). Code for doing this under SunOS, IRIX 5.X and 6.X,
171 HP/UX, Alpha OSF/1, Linux, and win32 is included and used by default. (See
172 README.win32 for win32 details.) On other systems pointers from dynamic
173 library data areas may not be considered by the collector.
175 Note that the garbage collector does not need to be informed of shared
176 read-only data. However if the shared library mechanism can introduce
177 discontiguous data areas that may contain pointers, then the collector does
180 Signal processing for most signals may be deferred during collection,
181 and during uninterruptible parts of the allocation process. Unlike
182 standard ANSI C mallocs, it can be safe to invoke malloc
183 from a signal handler while another malloc is in progress, provided
184 the original malloc is not restarted. (Empirically, many UNIX
185 applications already assume this.) To obtain this level of signal
186 safety, remove the definition of -DNO_SIGNALS in Makefile. This incurs
187 a minor performance penalty, and hence is no longer the default.
189 The allocator/collector can also be configured for thread-safe operation.
190 (Full signal safety can also be achieved, but only at the cost of two system
191 calls per malloc, which is usually unacceptable.)
193 INSTALLATION AND PORTABILITY
195 As distributed, the macro SILENT is defined in Makefile.
196 In the event of problems, this can be removed to obtain a moderate
197 amount of descriptive output for each collection.
198 (The given statistics exhibit a few peculiarities.
199 Things don't appear to add up for a variety of reasons, most notably
200 fragmentation losses. These are probably much more significant for the
201 contrived program "test.c" than for your application.)
203 Note that typing "make test" will automatically build the collector
204 and then run setjmp_test and gctest. Setjmp_test will give you information
205 about configuring the collector, which is useful primarily if you have
206 a machine that's not already supported. Gctest is a somewhat superficial
207 test of collector functionality. Failure is indicated by a core dump or
208 a message to the effect that the collector is broken. Gctest takes about
209 35 seconds to run on a SPARCstation 2. On a slower machine,
210 expect it to take a while. It may use up to 8 MB of memory. (The
211 multi-threaded version will use more.) "Make test" will also, as
212 its last step, attempt to build and test the "cord" string library.
213 This will fail without an ANSI C compiler.
215 The Makefile will generate a library gc.a which you should link against.
216 Typing "make cords" will add the cord library to gc.a.
217 Note that this requires an ANSI C compiler.
219 It is suggested that if you need to replace a piece of the collector
220 (e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the
222 ld command line, rather than replacing the one in gc.a. (This will
223 generate numerous warnings under some versions of AIX, but it still
226 All include files that need to be used by clients will be put in the
227 include subdirectory. (Normally this is just gc.h. "Make cords" adds
228 "cord.h" and "ec.h".)
230 The collector currently is designed to run essentially unmodified on
231 machines that use a flat 32-bit or 64-bit address space.
232 That includes the vast majority of Workstations and X86 (X >= 3) PCs.
233 (The list here was deleted because it was getting too long and constantly
235 It does NOT run under plain 16-bit DOS or Windows 3.X. There are however
236 various packages (e.g. win32s, djgpp) that allow flat 32-bit address
237 applications to run under those systemsif the have at least an 80386 processor,
238 and several of those are compatible with the collector.
240 In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile
241 or equivalent is supplied. Many of these have separate README.system
244 Dynamic libraries are completely supported only under SunOS
245 (and even that support is not functional on the last Sun 3 release),
246 IRIX 5&6, HP-PA, Win32 (not Win32S) and OSF/1 on DEC AXP machines.
247 On other machines we recommend that you do one of the following:
249 1) Add dynamic library support (and send us the code).
250 2) Use static versions of the libraries.
251 3) Arrange for dynamic libraries to use the standard malloc.
252 This is still dangerous if the library stores a pointer to a
253 garbage collected object. But nearly all standard interfaces
254 prohibit this, because they deal correctly with pointers
255 to stack allocated objects. (Strtok is an exception. Don't
258 In all cases we assume that pointer alignment is consistent with that
259 enforced by the standard C compilers. If you use a nonstandard compiler
260 you may have to adjust the alignment parameters defined in gc_priv.h.
262 A port to a machine that is not byte addressed, or does not use 32 bit
263 or 64 bit addresses will require a major effort. A port to plain MSDOS
266 For machines not already mentioned, or for nonstandard compilers, the
267 following are likely to require change:
269 1. The parameters in gcconfig.h.
270 The parameters that will usually require adjustment are
271 STACKBOTTOM, ALIGNMENT and DATASTART. Setjmp_test
272 prints its guesses of the first two.
273 DATASTART should be an expression for computing the
274 address of the beginning of the data segment. This can often be
275 &etext. But some memory management units require that there be
276 some unmapped space between the text and the data segment. Thus
277 it may be more complicated. On UNIX systems, this is rarely
278 documented. But the adb "$m" command may be helpful. (Note
279 that DATASTART will usually be a function of &etext. Thus a
280 single experiment is usually insufficient.)
281 STACKBOTTOM is used to initialize GC_stackbottom, which
282 should be a sufficient approximation to the coldest stack address.
283 On some machines, it is difficult to obtain such a value that is
284 valid across a variety of MMUs, OS releases, etc. A number of
285 alternatives exist for using the collector in spite of this. See the
286 discussion in gcconfig.h immediately preceding the various
287 definitions of STACKBOTTOM.
290 The most important routine here is one to mark from registers.
291 The distributed file includes a generic hack (based on setjmp) that
292 happens to work on many machines, and may work on yours. Try
293 compiling and running setjmp_t.c to see whether it has a chance of
294 working. (This is not correct C, so don't blame your compiler if it
295 doesn't work. Based on limited experience, register window machines
296 are likely to cause trouble. If your version of setjmp claims that
297 all accessible variables, including registers, have the value they
298 had at the time of the longjmp, it also will not work. Vanilla 4.2 BSD
299 on Vaxen makes such a claim. SunOS does not.)
300 If your compiler does not allow in-line assembly code, or if you prefer
301 not to use such a facility, mach_dep.c may be replaced by a .s file
302 (as we did for the MIPS machine and the PC/RT).
303 At this point enough architectures are supported by mach_dep.c
304 that you will rarely need to do more than adjust for assembler
307 3. os_dep.c (and gc_priv.h).
308 Several kinds of operating system dependent routines reside here.
309 Many are optional. Several are invoked only through corresponding
310 macros in gc_priv.h, which may also be redefined as appropriate.
311 The routine GC_register_data_segments is crucial. It registers static
312 data areas that must be traversed by the collector. (User calls to
313 GC_add_roots may sometimes be used for similar effect.)
314 Routines to obtain memory from the OS also reside here.
315 Alternatively this can be done entirely by the macro GET_MEM
316 defined in gc_priv.h. Routines to disable and reenable signals
317 also reside here if they are need by the macros DISABLE_SIGNALS
318 and ENABLE_SIGNALS defined in gc_priv.h.
319 In a multithreaded environment, the macros LOCK and UNLOCK
320 in gc_priv.h will need to be suitably redefined.
321 The incremental collector requires page dirty information, which
322 is acquired through routines defined in os_dep.c. Unless directed
323 otherwise by gcconfig.h, these are implemented as stubs that simply
324 treat all pages as dirty. (This of course makes the incremental
325 collector much less useful.)
328 This provides a routine that allows the collector to scan data
329 segments associated with dynamic libraries. Often it is not
330 necessary to provide this routine unless user-written dynamic
333 For a different version of UN*X or different machines using the
334 Motorola 68000, Vax, SPARC, 80386, NS 32000, PC/RT, or MIPS architecture,
335 it should frequently suffice to change definitions in gcconfig.h.
338 THE C INTERFACE TO THE ALLOCATOR
340 The following routines are intended to be directly called by the user.
341 Note that usually only GC_malloc is necessary. GC_clear_roots and GC_add_roots
342 calls may be required if the collector has to trace from nonstandard places
343 (e.g. from dynamic library data areas on a machine on which the
344 collector doesn't already understand them.) On some machines, it may
345 be desirable to set GC_stacktop to a good approximation of the stack base.
346 (This enhances code portability on HP PA machines, since there is no
347 good way for the collector to compute this value.) Client code may include
348 "gc.h", which defines all of the following, plus many others.
351 - allocate an object of size nbytes. Unlike malloc, the object is
352 cleared before being returned to the user. Gc_malloc will
353 invoke the garbage collector when it determines this to be appropriate.
354 GC_malloc may return 0 if it is unable to acquire sufficient
355 space from the operating system. This is the most probable
356 consequence of running out of space. Other possible consequences
357 are that a function call will fail due to lack of stack space,
358 or that the collector will fail in other ways because it cannot
359 maintain its internal data structures, or that a crucial system
360 process will fail and take down the machine. Most of these
361 possibilities are independent of the malloc implementation.
363 2) GC_malloc_atomic(nbytes)
364 - allocate an object of size nbytes that is guaranteed not to contain any
365 pointers. The returned object is not guaranteed to be cleared.
366 (Can always be replaced by GC_malloc, but results in faster collection
367 times. The collector will probably run faster if large character
368 arrays, etc. are allocated with GC_malloc_atomic than if they are
369 statically allocated.)
371 3) GC_realloc(object, new_size)
372 - change the size of object to be new_size. Returns a pointer to the
373 new object, which may, or may not, be the same as the pointer to
374 the old object. The new object is taken to be atomic iff the old one
375 was. If the new object is composite and larger than the original object,
376 then the newly added bytes are cleared (we hope). This is very likely
377 to allocate a new object, unless MERGE_SIZES is defined in gc_priv.h.
378 Even then, it is likely to recycle the old object only if the object
379 is grown in small additive increments (which, we claim, is generally bad
383 - explicitly deallocate an object returned by GC_malloc or
384 GC_malloc_atomic. Not necessary, but can be used to minimize
385 collections if performance is critical. Probably a performance
386 loss for very small objects (<= 8 bytes).
388 5) GC_expand_hp(bytes)
389 - Explicitly increase the heap size. (This is normally done automatically
390 if a garbage collection failed to GC_reclaim enough memory. Explicit
391 calls to GC_expand_hp may prevent unnecessarily frequent collections at
394 6) GC_malloc_ignore_off_page(bytes)
395 - identical to GC_malloc, but the client promises to keep a pointer to
396 the somewhere within the first 256 bytes of the object while it is
397 live. (This pointer should nortmally be declared volatile to prevent
398 interference from compiler optimizations.) This is the recommended
399 way to allocate anything that is likely to be larger than 100Kbytes
400 or so. (GC_malloc may result in failure to reclaim such objects.)
402 7) GC_set_warn_proc(proc)
403 - Can be used to redirect warnings from the collector. Such warnings
404 should be rare, and should not be ignored during code development.
406 8) GC_enable_incremental()
407 - Enables generational and incremental collection. Useful for large
408 heaps on machines that provide access to page dirty information.
409 Some dirty bit implementations may interfere with debugging
410 (by catching address faults) and place restrictions on heap arguments
411 to system calls (since write faults inside a system call may not be
414 9) Several routines to allow for registration of finalization code.
415 User supplied finalization code may be invoked when an object becomes
416 unreachable. To call (*f)(obj, x) when obj becomes inaccessible, use
417 GC_register_finalizer(obj, f, x, 0, 0);
418 For more sophisticated uses, and for finalization ordering issues,
421 The global variable GC_free_space_divisor may be adjusted up from its
422 default value of 4 to use less space and more collection time, or down for
423 the opposite effect. Setting it to 1 or 0 will effectively disable collections
424 and cause all allocations to simply grow the heap.
426 The variable GC_non_gc_bytes, which is normally 0, may be changed to reflect
427 the amount of memory allocated by the above routines that should not be
428 considered as a candidate for collection. Careless use may, of course, result
429 in excessive memory consumption.
431 Some additional tuning is possible through the parameters defined
432 near the top of gc_priv.h.
434 If only GC_malloc is intended to be used, it might be appropriate to define:
436 #define malloc(n) GC_malloc(n)
437 #define calloc(m,n) GC_malloc((m)*(n))
439 For small pieces of VERY allocation intensive code, gc_inl.h
440 includes some allocation macros that may be used in place of GC_malloc
443 All externally visible names in the garbage collector start with "GC_".
444 To avoid name conflicts, client code should avoid this prefix, except when
445 accessing garbage collector routines or variables.
447 There are provisions for allocation with explicit type information.
448 This is rarely necessary. Details can be found in gc_typed.h.
450 THE C++ INTERFACE TO THE ALLOCATOR:
452 The Ellis-Hull C++ interface to the collector is included in
453 the collector distribution. If you intend to use this, type
454 "make c++" after the initial build of the collector is complete.
455 See gc_cpp.h for the definition of the interface. This interface
456 tries to approximate the Ellis-Detlefs C++ garbage collection
457 proposal without compiler changes.
460 1. Arrays allocated without new placement syntax are
461 allocated as uncollectable objects. They are traced by the
462 collector, but will not be reclaimed.
464 2. Failure to use "make c++" in combination with (1) will
465 result in arrays allocated using the default new operator.
466 This is likely to result in disaster without linker warnings.
468 3. If your compiler supports an overloaded new[] operator,
469 then gc_cpp.cc and gc_cpp.h should be suitably modified.
471 4. Many current C++ compilers have deficiencies that
472 break some of the functionality. See the comments in gc_cpp.h
473 for suggested workarounds.
475 USE AS LEAK DETECTOR:
477 The collector may be used to track down leaks in C programs that are
478 intended to run with malloc/free (e.g. code with extreme real-time or
479 portability constraints). To do so define FIND_LEAK in Makefile
480 This will cause the collector to invoke the report_leak
481 routine defined near the top of reclaim.c whenever an inaccessible
482 object is found that has not been explicitly freed. The collector will
483 no longer reclaim inaccessible memory; in this form it is purely a
485 Productive use of this facility normally involves redefining report_leak
486 to do something more intelligent. This typically requires annotating
487 objects with additional information (e.g. creation time stack trace) that
488 identifies their origin. Such code is typically not very portable, and is
489 not included here, except on SPARC machines.
490 If all objects are allocated with GC_DEBUG_MALLOC (see next section),
491 then the default version of report_leak will report the source file
492 and line number at which the leaked object was allocated. This may
493 sometimes be sufficient. (On SPARC/SUNOS4 machines, it will also report
494 a cryptic stack trace. This can often be turned into a sympolic stack
495 trace by invoking program "foo" with "callprocs foo". Callprocs is
496 a short shell script that invokes adb to expand program counter values
497 to symbolic addresses. It was largely supplied by Scott Schwartz.)
498 Note that the debugging facilities described in the next section can
499 sometimes be slightly LESS effective in leak finding mode, since in
500 leak finding mode, GC_debug_free actually results in reuse of the object.
501 (Otherwise the object is simply marked invalid.) Also note that the test
502 program is not designed to run meaningfully in FIND_LEAK mode.
503 Use "make gc.a" to build the collector.
505 DEBUGGING FACILITIES:
507 The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc,
508 and GC_debug_free provide an alternate interface to the collector, which
509 provides some help with memory overwrite errors, and the like.
510 Objects allocated in this way are annotated with additional
511 information. Some of this information is checked during garbage
512 collections, and detected inconsistencies are reported to stderr.
514 Simple cases of writing past the end of an allocated object should
515 be caught if the object is explicitly deallocated, or if the
516 collector is invoked while the object is live. The first deallocation
517 of an object will clear the debugging info associated with an
518 object, so accidentally repeated calls to GC_debug_free will report the
519 deallocation of an object without debugging information. Out of
520 memory errors will be reported to stderr, in addition to returning
523 GC_debug_malloc checking during garbage collection is enabled
524 with the first call to GC_debug_malloc. This will result in some
525 slowdown during collections. If frequent heap checks are desired,
526 this can be achieved by explicitly invoking GC_gcollect, e.g. from
529 GC_debug_malloc allocated objects should not be passed to GC_realloc
530 or GC_free, and conversely. It is however acceptable to allocate only
531 some objects with GC_debug_malloc, and to use GC_malloc for other objects,
532 provided the two pools are kept distinct. In this case, there is a very
533 low probablility that GC_malloc allocated objects may be misidentified as
534 having been overwritten. This should happen with probability at most
535 one in 2**32. This probability is zero if GC_debug_malloc is never called.
537 GC_debug_malloc, GC_malloc_atomic, and GC_debug_realloc take two
538 additional trailing arguments, a string and an integer. These are not
539 interpreted by the allocator. They are stored in the object (the string is
540 not copied). If an error involving the object is detected, they are printed.
542 The macros GC_MALLOC, GC_MALLOC_ATOMIC, GC_REALLOC, GC_FREE, and
543 GC_REGISTER_FINALIZER are also provided. These require the same arguments
544 as the corresponding (nondebugging) routines. If gc.h is included
545 with GC_DEBUG defined, they call the debugging versions of these
546 functions, passing the current file name and line number as the two
547 extra arguments, where appropriate. If gc.h is included without GC_DEBUG
548 defined, then all these macros will instead be defined to their nondebugging
549 equivalents. (GC_REGISTER_FINALIZER is necessary, since pointers to
550 objects with debugging information are really pointers to a displacement
551 of 16 bytes form the object beginning, and some translation is necessary
552 when finalization routines are invoked. For details, about what's stored
553 in the header, see the definition of the type oh in debug_malloc.c)
555 INCREMENTAL/GENERATIONAL COLLECTION:
557 The collector normally interrupts client code for the duration of
558 a garbage collection mark phase. This may be unacceptable if interactive
559 response is needed for programs with large heaps. The collector
560 can also run in a "generational" mode, in which it usually attempts to
561 collect only objects allocated since the last garbage collection.
562 Furthermore, in this mode, garbage collections run mostly incrementally,
563 with a small amount of work performed in response to each of a large number of
566 This mode is enabled by a call to GC_enable_incremental().
568 Incremental and generational collection is effective in reducing
569 pause times only if the collector has some way to tell which objects
570 or pages have been recently modified. The collector uses two sources
573 1. Information provided by the VM system. This may be provided in
574 one of several forms. Under Solaris 2.X (and potentially under other
575 similar systems) information on dirty pages can be read from the
576 /proc file system. Under other systems (currently SunOS4.X) it is
577 possible to write-protect the heap, and catch the resulting faults.
578 On these systems we require that system calls writing to the heap
579 (other than read) be handled specially by client code.
580 See os_dep.c for details.
582 2. Information supplied by the programmer. We define "stubborn"
583 objects to be objects that are rarely changed. Such an object
584 can be allocated (and enabled for writing) with GC_malloc_stubborn.
585 Once it has been initialized, the collector should be informed with
586 a call to GC_end_stubborn_change. Subsequent writes that store
587 pointers into the object must be preceded by a call to
590 This mechanism performs best for objects that are written only for
591 initialization, and such that only one stubborn object is writable
592 at once. It is typically not worth using for short-lived
593 objects. Stubborn objects are treated less efficiently than pointerfree
596 A rough rule of thumb is that, in the absence of VM information, garbage
597 collection pauses are proportional to the amount of pointerful storage
598 plus the amount of modified "stubborn" storage that is reachable during
601 Initial allocation of stubborn objects takes longer than allocation
602 of other objects, since other data structures need to be maintained.
604 We recommend against random use of stubborn objects in client
605 code, since bugs caused by inappropriate writes to stubborn objects
606 are likely to be very infrequently observed and hard to trace.
607 However, their use may be appropriate in a few carefully written
608 library routines that do not make the objects themselves available
609 for writing by client code.
614 Any memory that does not have a recognizable pointer to it will be
615 reclaimed. Exclusive-or'ing forward and backward links in a list
617 Some C optimizers may lose the last undisguised pointer to a memory
618 object as a consequence of clever optimizations. This has almost
619 never been observed in practice. Send mail to boehm@acm.org
620 for suggestions on how to fix your compiler.
621 This is not a real-time collector. In the standard configuration,
622 percentage of time required for collection should be constant across
623 heap sizes. But collection pauses will increase for larger heaps.
624 (On SPARCstation 2s collection times will be on the order of 300 msecs
625 per MB of accessible memory that needs to be scanned. Your mileage
626 may vary.) The incremental/generational collection facility helps,
627 but is portable only if "stubborn" allocation is used.
628 Please address bug reports to boehm@acm.org. If you are
629 contemplating a major addition, you might also send mail to ask whether
630 it's already been done (or whether we tried and discarded it).
634 Version 1.3 and immediately preceding versions contained spurious
635 assembly language assignments to TMP_SP. Only the assignment in the PC/RT
636 code is necessary. On other machines, with certain compiler options,
637 the assignments can lead to an unsaved register being overwritten.
638 Known to cause problems under SunOS 3.5 WITHOUT the -O option. (With
639 -O the compiler recognizes it as dead code. It probably shouldn't,
640 but that's another story.)
642 Version 1.4 and earlier versions used compile time determined values
643 for the stack base. This no longer works on Sun 3s, since Sun 3/80s use
644 a different stack base. We now use a straightforward heuristic on all
645 machines on which it is known to work (incl. Sun 3s) and compile-time
646 determined values for the rest. There should really be library calls
647 to determine such values.
649 Version 1.5 and earlier did not ensure 8 byte alignment for objects
650 allocated on a sparc based machine.
652 Version 1.8 added ULTRIX support in gc_private.h.
654 Version 1.9 fixed a major bug in gc_realloc.
656 Version 2.0 introduced a consistent naming convention for collector
657 routines and added support for registering dynamic library data segments
658 in the standard mark_roots.c. Most of the data structures were revamped.
659 The treatment of interior pointers was completely changed. Finalization
660 was added. Support for locking was added. Object kinds were added.
661 We added a black listing facility to avoid allocating at addresses known
662 to occur as integers somewhere in the address space. Much of this
663 was accomplished by adapting ideas and code from the PCR collector.
664 The test program was changed and expanded.
666 Version 2.1 was the first stable version since 1.9, and added support
669 Version 2.2 added debugging allocation, and fixed various bugs. Among them:
670 - GC_realloc could fail to extend the size of the object for certain large object sizes.
671 - A blatant subscript range error in GC_printf, which unfortunately
672 wasn't exercised on machines with sufficient stack alignment constraints.
673 - GC_register_displacement did the wrong thing if it was called after
674 any allocation had taken place.
675 - The leak finding code would eventually break after 2048 byte
677 - interface.c didn't compile.
678 - The heap size remained much too small for large stacks.
679 - The stack clearing code behaved badly for large stacks, and perhaps
682 Version 2.3 added ALL_INTERIOR_POINTERS and fixed the following bugs:
683 - Missing declaration of etext in the A/UX version.
684 - Some PCR root-finding problems.
685 - Blacklisting was not 100% effective, because the plausible future
686 heap bounds were being miscalculated.
687 - GC_realloc didn't handle out-of-memory correctly.
688 - GC_base could return a nonzero value for addresses inside free blocks.
689 - test.c wasn't really thread safe, and could erroneously report failure
690 in a multithreaded environment. (The locking primitives need to be
691 replaced for other threads packages.)
692 - GC_CONS was thoroughly broken.
693 - On a SPARC with dynamic linking, signals stayed diabled while the
694 client code was running.
695 (Thanks to Manuel Serrano at INRIA for reporting the last two.)
697 Version 2.4 added GC_free_space_divisor as a tuning knob, added
698 support for OS/2 and linux, and fixed the following bugs:
699 - On machines with unaligned pointers (e.g. Sun 3), every 128th word could
700 fail to be considered for marking.
701 - Dynamic_load.c erroneously added 4 bytes to the length of the data and
702 bss sections of the dynamic library. This could result in a bad memory
703 reference if the actual length was a multiple of a page. (Observed on
704 Sun 3. Can probably also happen on a Sun 4.)
705 (Thanks to Robert Brazile for pointing out that the Sun 3 version
706 was broken. Dynamic library handling is still broken on Sun 3s
707 under 4.1.1U1, but apparently not 4.1.1. If you have such a machine,
710 Version 2.5 fixed the following bugs:
711 - Removed an explicit call to exit(1)
712 - Fixed calls to GC_printf and GC_err_printf, so the correct number of
713 arguments are always supplied. The OS/2 C compiler gets confused if
714 the number of actuals and the number of formals differ. (ANSI C
715 doesn't require this to work. The ANSI sanctioned way of doing things
716 causes too many compatibility problems.)
718 Version 3.0 added generational/incremental collection and stubborn
721 Version 3.1 added the following features:
722 - A workaround for a SunOS 4.X SPARC C compiler
723 misfeature that caused problems when the collector was turned into
725 - A fix for a bug in GC_base that could result in a memory fault.
726 - A fix for a performance bug (and several other misfeatures) pointed
727 out by Dave Detlefs and Al Dosser.
728 - Use of dirty bit information for static data under Solaris 2.X.
729 - DEC Alpha/OSF1 support (thanks to Al Dosser).
730 - Incremental collection on more platforms.
731 - A more refined heap expansion policy. Less space usage by default.
732 - Various minor enhancements to reduce space usage, and to reduce
733 the amount of memory scanned by the collector.
734 - Uncollectable allocation without per object overhead.
735 - More conscientious handling of out-of-memory conditions.
736 - Fixed a bug in debugging stubborn allocation.
737 - Fixed a bug that resulted in occasional erroneous reporting of smashed
738 objects with debugging allocation.
739 - Fixed bogus leak reports of size 4096 blocks with FIND_LEAK.
741 Version 3.2 fixed a serious and not entirely repeatable bug in
742 the incremental collector. It appeared only when dirty bit info
743 on the roots was available, which is normally only under Solaris.
744 It also added GC_general_register_disappearing_link, and some
745 testing code. Interface.c disappeared.
747 Version 3.3 fixes several bugs and adds new ports:
749 - Missing locking in GC_free, redundant FASTUNLOCK
750 in GC_malloc_stubborn, and 2 bugs in
751 GC_unregister_disappearing_link.
752 All of the above were pointed out by Neil Sharman
754 - Common symbols allocated by the SunOS4.X dynamic loader
755 were not included in the root set.
756 - Bug in GC_finalize (reported by Brian Beuning and Al Dosser)
757 - Merged Amiga port from Jesper Peterson (untested)
758 - Merged NeXT port from Thomas Funke (significantly
759 modified and untested)
762 - Fixed a performance bug in GC_realloc.
763 - Updated the amiga port.
764 - Added NetBSD and 386BSD ports.
765 - Added cord library.
766 - Added trivial performance enhancement for
767 ALL_INTERIOR_POINTERS. (Don't scan last word.)
770 - Minor collections now mark from roots only once, if that
771 doesn't cause an excessive pause.
772 - The stack clearing heuristic was refined to prevent anomalies
773 with very heavily recursive programs and sparse stacks.
774 - Fixed a bug that prevented mark stack growth in some cases.
775 GC_objects_are_marked should be set to TRUE after a call
776 to GC_push_roots and as part of GC_push_marked, since
777 both can now set mark bits. I think this is only a performance
778 bug, but I wouldn't bet on it. It's certainly very hard to argue
779 that the old version was correct.
780 - Fixed an incremental collection bug that prevented it from
781 working at all when HBLKSIZE != getpagesize()
782 - Changed dynamic_loading.c to include gc_priv.h before testing
783 DYNAMIC_LOADING. SunOS dynamic library scanning
784 must have been broken in 3.4.
785 - Object size rounding now adapts to program behavior.
786 - Added a workaround (provided by Manuel Serrano and
787 colleagues) to a long-standing SunOS 4.X (and 3.X?) ld bug
788 that I had incorrectly assumed to have been squished.
789 The collector was broken if the text segment size was within
790 32 bytes of a multiple of 8K bytes, and if the beginning of
791 the data segment contained interesting roots. The workaround
792 assumes a demand-loadable executable. The original may have
793 have "worked" in some other cases.
794 - Added dynamic library support under IRIX5.
795 - Added support for EMX under OS/2 (thanks to Ari Huttunen).
798 - fixed a bug in the mark stack growth code that was introduced
800 - fixed Makefile to work around DEC AXP compiler tail recursion
804 - Added a workaround for an HP/UX compiler bug.
805 - Fixed another stack clearing performance bug. Reworked
809 - Added support for Solaris threads (which was possible
810 only by reimplementing some fraction of Solaris threads,
811 since Sun doesn't currently make the thread debugging
812 interface available).
813 - Added non-threads win32 and win32S support.
814 - (Grudgingly, with suitable muttering of obscenities) renamed
815 files so that the collector distribution could live on a FAT
816 file system. Files that are guaranteed to be useless on
817 a PC still have long names. Gc_inline.h and gc_private.h
818 still exist, but now just include gc_inl.h and gc_priv.h.
819 - Fixed a really obscure bug in finalization that could cause
820 undetected mark stack overflows. (I would be surprised if
821 any real code ever tickled this one.)
822 - Changed finalization code to dynamically resize the hash
823 tables it maintains. (This probably does not matter for well-
824 -written code. It no doubt does for C++ code that overuses
826 - Added typed allocation primitives. Rewrote the marker to
827 accommodate them with more reasonable efficiency. This
828 change should also speed up marking for GC_malloc allocated
829 objects a little. See gc_typed.h for new primitives.
830 - Improved debugging facilities slightly. Allocation time
831 stack traces are now kept by default on SPARC/SUNOS4.
832 (Thanks to Scott Schwartz.)
833 - Added better support for small heap applications.
834 - Significantly extended cord package. Fixed a bug in the
835 implementation of lazily read files. Printf and friends now
836 have cord variants. Cord traversals are a bit faster.
837 - Made ALL_INTERIOR_POINTERS recognition the default.
838 - Fixed de so that it can run in constant space, independent
839 of file size. Added simple string searching to cords and de.
840 - Added the Hull-Ellis C++ interface.
841 - Added dynamic library support for OSF/1.
842 (Thanks to Al Dosser and Tim Bingham at DEC.)
843 - Changed argument to GC_expand_hp to be expressed
844 in units of bytes instead of heap blocks. (Necessary
845 since the heap block size now varies depending on
846 configuration. The old version was never very clean.)
847 - Added GC_get_heap_size(). The previous "equivalent"
849 - Restructured the Makefile a bit.
852 - Changed finalization implementation to guarantee that
853 finalization procedures are called outside of the allocation
854 lock, making direct use of the interface a little less dangerous.
855 MAY BREAK EXISTING CLIENTS that assume finalizers
856 are protected by a lock. Since there seem to be few multithreaded
857 clients that use finalization, this is hopefully not much of
859 - Fixed a gross bug in CORD_prev.
860 - Fixed a bug in blacklst.c that could result in unbounded
861 heap growth during startup on machines that do not clear
862 memory obtained from the OS (e.g. win32S).
863 - Ported de editor to win32/win32S. (This is now the only
864 version with a mouse-sensitive UI.)
865 - Added GC_malloc_ignore_off_page to allocate large arrays
866 in the presence of ALL_INTERIOR_POINTERS.
867 - Changed GC_call_with_alloc_lock to not disable signals in
868 the single-threaded case.
869 - Reduced retry count in GC_collect_or_expand for garbage
870 collecting when out of memory.
871 - Made uncollectable allocations bypass black-listing, as they
873 - Fixed a bug in typed_test in test.c that could cause (legitimate)
875 - Fixed some potential synchronization problems in finalize.c
876 - Fixed a real locking problem in typd_mlc.c.
877 - Worked around an AIX 3.2 compiler feature that results in
878 out of bounds memory references.
879 - Partially worked around an IRIX5.2 beta problem (which may
880 or may not persist to the final release).
881 - Fixed a bug in the heap integrity checking code that could
882 result in explicitly deallocated objects being identified as
883 smashed. Fixed a bug in the dbg_mlc stack saving code
884 that caused old argument pointers to be considered live.
885 - Fixed a bug in CORD_ncmp (and hence CORD_str).
886 - Repaired the OS2 port, which had suffered from bit rot
887 in 4.0. Worked around what appears to be CSet/2 V1.0
889 - Fixed a Makefile bug for target "c++".
892 - Multiple bug fixes/workarounds in the Solaris threads version.
893 (It occasionally failed to locate some register contents for
894 marking. It also turns out that thr_suspend and friends are
895 unreliable in Solaris 2.3. Dirty bit reads appear
896 to be unreliable under some weird
897 circumstances. My stack marking code
898 contained a serious performance bug. The new code is
899 extremely defensive, and has not failed in several cpu
900 hours of testing. But no guarantees ...)
901 - Added MacOS support (thanks to Patrick Beard.)
902 - Fixed several syntactic bugs in gc_c++.h and friends. (These
903 didn't bother g++, but did bother most other compilers.)
904 Fixed gc_c++.h finalization interface. (It didn't.)
905 - 64 bit alignment for allocated objects was not guaranteed in a
906 few cases in which it should have been.
907 - Added GC_malloc_atomic_ignore_off_page.
908 - Added GC_collect_a_little.
909 - Added some prototypes to gc.h.
910 - Some other minor bug fixes (notably in Makefile).
911 - Fixed OS/2 / EMX port (thanks to Ari Huttunen).
912 - Fixed AmigaDOS port. (thanks to Michel Schinz).
913 - Fixed the DATASTART definition under Solaris. There
914 was a 1 in 16K chance of the collector missing the first
915 64K of static data (and thus crashing).
916 - Fixed some blatant anachronisms in the README file.
917 - Fixed PCR-Makefile for upcoming PPCR release.
920 - Fixed SPARC alignment problem with GC_DEBUG.
921 - Fixed Solaris threads /proc workaround. The real
922 problem was an interaction with mprotect.
923 - Incorporated fix from Patrick Beard for gc_c++.h (now gc_cpp.h).
924 - Slightly improved allocator space utilization by
925 fixing the GC_size_map mechanism.
926 - Integrated some Sony News and MIPS RISCos 4.51
927 patches. (Thanks to Nobuyuki Hikichi of
928 Software Research Associates, Inc. Japan)
929 - Fixed HP_PA alignment problem. (Thanks to
930 xjam@cork.cs.berkeley.edu.)
931 - Added GC_same_obj and friends. Changed GC_base
932 to return 0 for pointers past the end of large objects.
933 Improved GC_base performance with ALL_INTERIOR_POINTERS
934 on machines with a slow integer mod operation.
935 Added GC_PTR_ADD, GC_PTR_STORE, etc. to prepare
937 - changed the default on most UNIX machines to be that
938 signals are not disabled during critical GC operations.
939 This is still ANSI-conforming, though somewhat dangerous
940 in the presence of signal handlers. But the performance
941 cost of the alternative is sometimes problematic.
942 Can be changed back with a minor Makefile edit.
943 - renamed IS_STRING in gc.h, to CORD_IS_STRING, thus
944 following my own naming convention. Added the function
945 CORD_to_const_char_star.
946 - Fixed a gross bug in GC_finalize. Symptom: occasional
947 address faults in that function. (Thanks to Anselm
948 Baird-Smith (Anselm.BairdSmith@inria.fr)
949 - Added port to ICL DRS6000 running DRS/NX. Restructured
950 things a bit to factor out common code, and remove obsolete
951 code. Collector should now run under SUNOS5 with either
952 mprotect or /proc dirty bits. (Thanks to Douglas Steel
953 (doug@wg.icl.co.uk)).
954 - More bug fixes and workarounds for Solaris 2.X. (These were
955 mostly related to putting the collector in a dynamic library,
956 which didn't really work before. Also SOLARIS_THREADS
957 didn't interact well with dl_open.) Thanks to btlewis@eng.sun.com.
958 - Fixed a serious performance bug on the DEC Alpha. The text
959 segment was getting registered as part of the root set.
960 (Amazingly, the result was still fast enough that the bug
961 was not conspicuous.) The fix works on OSF/1, version 1.3.
962 Hopefully it also works on other versions of OSF/1 ...
963 - Fixed a bug in GC_clear_roots.
964 - Fixed a bug in GC_generic_malloc_words_small that broke
965 gc_inl.h. (Reported by Antoine de Maricourt. I broke it
966 in trying to tweak the Mac port.)
967 - Fixed some problems with cord/de under Linux.
968 - Fixed some cord problems, notably with CORD_riter4.
970 Thanks to Ben A. Mesander (ben@piglet.cr.usgs.gov)
971 - Added finalization registration routines with weaker ordering
972 constraints. (This is necessary for C++ finalization with
973 multiple inheritance, since the compiler often adds self-cycles.)
974 - Filled the holes in the SCO port. (Thanks to Michael Arnoldus
976 - John Ellis' additions to the C++ support: From John:
978 * I completely rewrote the documentation in the interface gc_c++.h
979 (later renamed gc_cpp.h). I've tried to make it both clearer and more
982 * The definition of accessibility now ignores pointers from an
983 finalizable object (an object with a clean-up function) to itself.
984 This allows objects with virtual base classes to be finalizable by the
985 collector. Compilers typically implement virtual base classes using
986 pointers from an object to itself, which under the old definition of
987 accessibility prevented objects with virtual base classes from ever
988 being collected or finalized.
990 * gc_cleanup now includes gc as a virtual base. This was enabled by
991 the change in the definition of accessibility.
993 * I added support for operator new[]. Since most (all?) compilers
994 don't yet support operator new[], it is conditionalized on
995 -DOPERATOR_NEW_ARRAY. The code is untested, but its trivial and looks
998 * The test program test_gc_c++ (later renamed test_cpp.cc)
999 tries to test for the C++-specific functionality not tested by the
1001 - Added <unistd.h> include to misc.c. (Needed for ppcr.)
1002 - Added PowerMac port. (Thanks to Patrick Beard again.)
1003 - Fixed "srcdir"-related Makefile problems. Changed things so
1004 that all externally visible include files always appear in the
1005 include subdirectory of the source. Made gc.h directly
1006 includable from C++ code. (These were at Per
1007 Bothner's suggestion.)
1008 - Changed Intel code to also mark from ebp (Kevin Warne's
1010 - Renamed C++ related files so they could live in a FAT
1011 file system. (Charles Fiterman's suggestion.)
1012 - Changed Windows NT Makefile to include C++ support in
1013 gc.lib. Added C++ test as Makefile target.
1016 - ASM_CLEAR_CODE was erroneously defined for HP
1017 PA machines, resulting in a compile error.
1018 - Fixed OS/2 Makefile to create a library. (Thanks to
1019 Mark Boulter (mboulter@vnet.ibm.com)).
1020 - Gc_cleanup objects didn't work if they were created on
1022 - One copy of Gc_cpp.h in the distribution was out of
1023 synch, and failed to document some known compiler
1024 problems with explicit destructor invocation. Partially
1025 fixed. There are probably other compilers on which
1026 gc_cleanup is miscompiled.
1027 - Fixed Makefile to pass C compiler flags to C++ compiler.
1029 - Fixed os_dep.c to work around what appears to be
1030 a new and different VirtualQuery bug under newer
1032 - GC_non_gc_bytes was not correctly maintained by
1033 GC_free. Fixed. Thanks to James Clark (jjc@jclark.com).
1034 - Added GC_set_max_heap_size.
1035 - Changed allocation code to ignore blacklisting if it is preventing
1036 use of a very large block of memory. This has the advantage
1037 that naive code allocating very large objects is much more
1038 likely to work. The downside is you might no
1039 longer find out that such code should really use
1040 GC_malloc_ignore_off_page.
1041 - Changed GC_printf under win32 to close and reopen the file
1042 between calls. FAT file systems otherwise make the log file
1043 useless for debugging.
1044 - Added GC_try_to_collect and GC_get_bytes_since_gc. These
1045 allow starting an abortable collection during idle times.
1046 This facility does not require special OS support. (Thanks to
1047 Michael Spertus of Geodesic Systems for suggesting this. It was
1048 actually an easy addition. Kumar Srikantan previously added a similar
1049 facility to a now ancient version of the collector. At the time
1050 this was much harder, and the result was less convincing.)
1051 - Added some support for the Borland development environment. (Thanks
1052 to John Ellis and Michael Spertus.)
1053 - Removed a misfeature from checksums.c that caused unexpected
1054 heap growth. (Thanks to Scott Schwartz.)
1055 - Changed finalize.c to call WARN if it encounters a finalization cycle.
1056 WARN is defined in gc_priv.h to write a message, usually to stdout.
1057 In many environments, this may be inappropriate.
1058 - Renamed NO_PARAMS in gc.h to GC_NO_PARAMS, thus adhering to my own
1060 - Added GC_set_warn_proc to intercept warnings.
1061 - Fixed Amiga port. (Thanks to Michel Schinz (schinz@alphanet.ch).)
1062 - Fixed a bug in mark.c that could result in an access to unmapped
1063 memory from GC_mark_from_mark_stack on machines with unaligned
1065 - Fixed a win32 specific performance bug that could result in scanning of
1066 objects allocated with the system malloc.
1067 - Added REDIRECT_MALLOC.
1070 - Fixed many minor and one major README bugs. (Thanks to Franklin Chen
1071 (chen@adi.com) for pointing out many of them.)
1072 - Fixed ALPHA/OSF/1 dynamic library support. (Thanks to Jonathan Bachrach
1073 (jonathan@harlequin.com)).
1074 - Added incremental GC support (MPROTECT_VDB) for Linux (with some
1075 help from Bruno Haible).
1076 - Altered SPARC recognition tests in gc.h and config.h (mostly as
1077 suggested by Fergus Henderson).
1078 - Added basic incremental GC support for win32, as implemented by
1079 Windows NT and Windows 95. GC_enable_incremental is a noop
1080 under win32s, which doesn't implement enough of the VM interface.
1081 - Added -DLARGE_CONFIG.
1082 - Fixed GC_..._ignore_off_page to also function without
1083 -DALL_INTERIOR_POINTERS.
1084 - (Hopefully) fixed RS/6000 port. (Only the test was broken.)
1085 - Fixed a performance bug in the nonincremental collector running
1086 on machines supporting incremental collection with MPROTECT_VDB
1087 (e.g. SunOS 4, DEC AXP). This turned into a correctness bug under
1088 win32s with win32 incremental collection. (Not all memory protection
1090 - Fixed some ppcr related bit rot.
1091 - Caused dynamic libraries to be unregistered before reregistering.
1092 The old way turned out to be a performance bug on some machines.
1093 - GC_root_size was not properly maintained under MSWIN32.
1094 - Added -DNO_DEBUGGING and GC_dump.
1095 - Fixed a couple of bugs arising with SOLARIS_THREADS +
1097 - Added NetBSD/M68K port. (Thanks to Peter Seebach
1098 <seebs@taniemarie.solon.com>.)
1099 - Fixed a serious realloc bug. For certain object sizes, the collector
1100 wouldn't scan the expanded part of the object. (Thanks to Clay Spence
1101 (cds@peanut.sarnoff.com) for noticing the problem, and helping me to
1105 - Added Linux ELF support. (Thanks to Arrigo Triulzi <arrigo@ic.ac.uk>.)
1106 - GC_base crashed if it was called before any other GC_ routines.
1107 This could happen if a gc_cleanup object was allocated outside the heap
1108 before any heap allocation.
1109 - The heap expansion heuristic was not stable if all objects had finalization
1110 enabled. Fixed finalize.c to count memory in finalization queue and
1111 avoid explicit deallocation. Changed alloc.c to also consider this count.
1112 (This is still not recommended. It's expensive if nothing else.) Thanks
1113 to John Ellis for pointing this out.
1114 - GC_malloc_uncollectable(0) was broken. Thanks to Phong Vo for pointing
1116 - The collector didn't compile under Linux 1.3.X. (Thanks to Fred Gilham for
1117 pointing this out.) The current workaround is ugly, but expected to be
1119 - Fixed a formatting problem for SPARC stack traces.
1120 - Fixed some '=='s in os_dep.c that should have been assignments.
1121 Fortunately these were in code that should never be executed anyway.
1122 (Thanks to Fergus Henderson.)
1123 - Fixed the heap block allocator to only drop blacklisted blocks in small
1124 chunks. Made BL_LIMIT self adjusting. (Both of these were in response
1125 to heap growth observed by Paul Graham.)
1126 - Fixed the Metrowerks/68K Mac code to also mark from a6. (Thanks
1128 - Significantly updated README.debugging.
1129 - Fixed some problems with longjmps out of signal handlers, especially under
1130 Solaris. Added a workaround for the fact that siglongjmp doesn't appear to
1131 do the right thing with -lthread under Solaris.
1132 - Added MSDOS/djgpp port. (Thanks to Mitch Harris (maharri@uiuc.edu).)
1133 - Added "make reserved_namespace" and "make user_namespace". The
1134 first renames ALL "GC_xxx" identifiers as "_GC_xxx". The second is the
1135 inverse transformation. Note that doing this is guaranteed to break all
1136 clients written for the other names.
1137 - descriptor field for kind NORMAL in GC_obj_kinds with ADD_BYTE_AT_END
1138 defined should be -ALIGNMENT not WORDS_TO_BYTES(-1). This is
1139 a serious bug on machines with pointer alignment of less than a word.
1140 - GC_ignore_self_finalize_mark_proc didn't handle pointers to very near the
1141 end of the object correctly. Caused failures of the C++ test on a DEC Alpha
1143 - gc_inl.h still had problems. Partially fixed. Added warnings at the
1144 beginning to hopefully specify the remaining dangers.
1145 - Added DATAEND definition to config.h.
1146 - Fixed some of the .h file organization. Fixed "make floppy".
1149 - Fixed some compilation problems with -DCHECKSUMS (thanks to Ian Searle)
1150 - Updated some Mac specific files to synchronize with Patrick Beard.
1151 - Fixed a serious bug for machines with non-word-aligned pointers.
1152 (Thanks to Patrick Beard for pointing out the problem. The collector
1153 should fail almost any conceivable test immediately on such machines.)
1156 - Changed a "comment" in a MacOS specific part of mach-dep.c that caused
1157 gcc to fail on other platforms.
1160 - More README.debugging fixes.
1161 - Objects ready for finalization, but not finalized in the same GC
1162 cycle, could be prematurely collected. This occasionally happened
1164 - Too little memory was obtained from the system for very large
1165 objects. That could cause a heap explosion if these objects were
1166 not contiguous (e.g. under PCR), and too much of them was blacklisted.
1167 - Due to an improper initialization, the collector was too hesitant to
1168 allocate blacklisted objects immediately after system startup.
1169 - Moved GC_arrays from the data into the bss segment by not explicitly
1170 initializing it to zero. This significantly
1171 reduces the size of executables, and probably avoids some disk accesses
1172 on program startup. It's conceivable that it might break a port that I
1174 - Fixed EMX_MAKEFILE to reflect the gc_c++.h to gc_cpp.h renaming which
1175 occurred a while ago.
1178 - Fixed a typo around a call to GC_collect_or_expand in alloc.c. It broke
1179 handling of out of memory. (Thanks to Patrick Beard for noticing.)
1182 - Rationalized (hopefully) GC_try_to_collect in an incremental collection
1183 environment. It appeared to not handle a call while a collection was in
1184 progress, and was otherwise too conservative.
1185 - Merged GC_reclaim_or_delete_all into GC_reclaim_all to get rid of some
1187 - Added Patrick Beard's Mac fixes, with substantial completely untested
1189 - Fixed the MPROTECT_VDB code to deal with large pages and imprecise
1190 fault addresses (as on an UltraSPARC running Solaris 2.5). Note that this
1191 was not a problem in the default configuration, which uses PROC_VDB.
1192 - The DEC Alpha assembly code needed to restore $gp between calls.
1193 Thanks to Fergus Henderson for tracking this down and supplying a
1195 - The write command for "de" was completely broken for large files.
1196 I used the easiest portable fix, which involved changing the semantics
1197 so that f.new is written instead of overwriting f. That's safer anyway.
1198 - Added README.solaris2 with a discussion of the possible problems of
1199 mixing the collector's sbrk allocation with malloc/realloc.
1200 - Changed the data segment starting address for SGI machines. The
1201 old code failed under IRIX6.
1202 - Required double word alignment for MIPS.
1203 - Various minor fixes to remove warnings.
1204 - Attempted to fix some Solaris threads problems reported by Zhiying Chen.
1205 In particular, the collector could try to fork a thread with the
1206 world stopped as part of GC_thr_init. It also failed to deal with
1207 the case in which the original thread terminated before the whole
1209 - Added -DNO_EXECUTE_PERMISSION. This has a major performance impact
1210 on the incremental collector under Irix, and perhaps under other
1212 - Added some code to support allocating the heap with mmap. This may
1213 be preferable under some circumstances.
1214 - Integrated dynamic library support for HP.
1215 (Thanks to Knut Tvedten <knuttv@ifi.uio.no>.)
1216 - Integrated James Clark's win32 threads support, and made a number
1217 of changes to it, many of which were suggested by Pontus Rydin.
1218 This is still not 100% solid.
1219 - Integrated Alistair Crooks' support for UTS4 running on an Amdahl
1221 - Fixed a serious bug in explicitly typed allocation. Objects requiring
1222 large descriptors where handled in a way that usually resulted in
1223 a segmentation fault in the marker. (Thanks to Jeremy Fitzhardinge
1224 for helping to track this down.)
1225 - Added partial support for GNU win32 development. (Thanks to Fergus
1227 - Added optional support for Java-style finalization semantics. (Thanks
1228 to Patrick Bridges.) This is recommended only for Java implementations.
1229 - GC_malloc_uncollectable faulted instead of returning 0 when out of
1230 memory. (Thanks to dan@math.uiuc.edu for noticing.)
1231 - Calls to GC_base before the collector was initialized failed on a
1232 DEC Alpha. (Thanks to Matthew Flatt.)
1233 - Added base pointer checking to GC_REGISTER_FINALIZER in debugging
1234 mode, at the suggestion of Jeremy Fitzhardinge.
1235 - GC_debug_realloc failed for uncollectable objects. (Thanks to
1236 Jeremy Fitzhardinge.)
1237 - Explicitly typed allocation could crash if it ran out of memory.
1238 (Thanks to Jeremy Fitzhardinge.)
1239 - Added minimal support for a DEC Alpha running Linux.
1240 - Fixed a problem with allocation of objects whose size overflowed
1241 ptrdiff_t. (This now fails unconditionally, as it should.)
1242 - Added the beginning of Irix pthread support.
1243 - Integrated Xiaokun Zhu's fixes for djgpp 2.01.
1244 - Added SGI-style STL allocator support (gc_alloc.h).
1245 - Fixed a serious bug in README.solaris2. Multithreaded programs must include
1246 gc.h with SOLARIS_THREADS defined.
1247 - Changed GC_free so it actually deallocates uncollectable objects.
1248 (Thanks to Peter Chubb for pointing out the problem.)
1249 - Added Linux ELF support for dynamic libararies. (Thanks again to
1251 - Changed the Borland cc configuration so that the assembler is not
1253 - Fixed a bug in the C++ test that caused it to fail in 64-bit
1257 - Fixed ElfW definition in dyn_load.c. (Thanks to Fergus Henderson.)
1258 This prevented the dynamic library support from compiling on some
1259 older ELF Linux systems.
1260 - Fixed UTS4 port (which I apparently mangled during the integration)
1261 (Thanks to again to Alistair Crooks.)
1262 - "Make C++" failed on Suns with SC4.0, due to a problem with "bool".
1264 - Added more pieces for GNU win32. (Thanks to Timothy N. Newsham.)
1265 The current state of things should suffice for at least some
1267 - Changed the out of memory retry count handling as suggested by
1268 Kenjiro Taura. (This matters only if GC_max_retries > 0, which
1269 is no longer the default.)
1270 - If a /proc read failed repeatedly, GC_written_pages was not updated
1271 correctly. (Thanks to Peter Chubb for diagnosing this.)
1272 - Under unlikely circumstances, the allocator could infinite loop in
1273 an out of memory situation. (Thanks again to Kenjiro Taura for
1274 identifying the problem and supplying a fix.)
1275 - Fixed a syntactic error in the DJGPP code. (Thanks to Fergus
1276 Henderson for finding this by inspection.) Also fixed a test program
1277 problem with DJGPP (Thanks to Peter Monks.)
1278 - Atomic uncollectable objects were not treated correctly by the
1279 incremental collector. This resulted in weird log statistics and
1280 occasional performance problems. (Thanks to Peter Chubb for pointing
1282 - Fixed some problems resulting from compilers that dont define
1283 __STDC__. In this case void * and char * were used inconsistently
1284 in some cases. (Void * should not have been used at all. If
1285 you have an ANSI superset compiler that does not define __STDC__,
1286 please compile with -D__STDC__=0. Thanks to Manuel Serrano and others
1287 for pointing out the problem.)
1288 - Fixed a compilation problem on Irix with -n32 and -DIRIX_THREADS.
1289 Also fixed some other IRIX_THREADS problems which may or may not have
1290 had observable symptoms.
1291 - Fixed an HP PA compilation problem in dyn_load.c. (Thanks to
1293 - SEGV fault handlers sometimes did not get reset correctly. (Thanks
1295 - Added a fix for SOLARIS_THREADS on Intel. (Thanks again to David
1296 Pickens.) This probably needs more work to become functional.
1297 - Fixed struct sigcontext_struct in os_dep.c for compilation under
1298 Linux 2.1.X. (Thanks to Fergus Henderson.)
1299 - Changed the DJGPP STACKBOTTOM and DATASTART values to those suggested
1300 by Kristian Kristensen. These may still not be right, but it is
1301 it is likely to work more often than what was there before. They may
1302 even be exactly right.
1303 - Added a #include <string.h> to test_cpp.cc. This appears to help
1304 with HP/UX and gcc. (Thanks to assar@sics.se.)
1305 - Version 4.11 failed to run in incremental mode on recent 64-bit Irix
1306 kernels. This was a problem related to page unaligned heap segments.
1307 Changed the code to page align heap sections on all platforms.
1308 (I had mistakenly identified this as a kernel problem earlier.
1310 - Version 4.11 did not make allocated storage executable, except on
1311 one or two platforms, due to a bug in a #if test. (Thanks to Dave
1312 Grove for pointing this out.)
1313 - Added sparc_sunos4_mach_dep.s to support Sun's compilers under SunOS4.
1314 - Added GC_exclude_static_roots.
1315 - Fixed the object size mapping algorithm. This shouldn't matter,
1316 but the old code was ugly.
1317 - Heap checking code could die if one of the allocated objects was
1318 larger than its base address. (Unsigned underflow problem. Thanks
1319 to Clay Spence for isolating the problem.)
1320 - Added RS6000 (AIX) dynamic library support and fixed STACK_BOTTOM.
1321 (Thanks to Fred Stearns.)
1322 - Added Fergus Henderson's patches for improved robustness with large
1323 heaps and lots of blacklisting.
1324 - Added Peter Chubb's changes to support Solaris Pthreads, to support
1325 MMAP allocation in Solaris, to allow Solaris to find dynamic libraries
1326 through /proc, to add malloc_typed_ignore_off_page, and a few other
1327 minor features and bug fixes.
1328 - The Solaris 2 port should not use sbrk. I received confirmation from
1329 Sun that the use of sbrk and malloc in the same program is not
1330 supported. The collector now defines USE_MMAP by default on Solaris.
1331 - Replaced the djgpp makefile with Gary Leavens' version.
1332 - Fixed MSWIN32 detection test.
1333 - Added Fergus Henderson's patches to allow putting the collector into
1334 a DLL under GNU win32.
1335 - Added Ivan V. Demakov's port to Watcom C on X86.
1336 - Added Ian Piumarta's Linux/PowerPC port.
1337 - On Brian Burton's suggestion added PointerFreeGC to the placement
1338 options in gc_cpp.h. This is of course unsafe, and may be controversial.
1339 On the other hand, it seems to be needed often enough that it's worth
1340 adding as a standard facility.
1343 - Fixed a crucial bug in the Watcom port. There was a redundant decl
1344 of GC_push_one in gc_priv.h.
1345 - Added FINALIZE_ON_DEMAND.
1346 - Fixed some pre-ANSI cc problems in test.c.
1347 - Removed getpagesize() use for Solaris. It seems to be missing in one
1349 - Fixed bool handling for SPARCCompiler version 4.2.
1350 - Fixed some files in include that had gotten unlinked from the main
1352 - Some RS/6000 fixes (missing casts). Thanks to Toralf Foerster.
1353 - Fixed several problems in GC_debug_realloc, affecting mostly the
1355 - GC_exclude_static_roots contained a buggy unsigned comparison to
1356 terminate a loop. (Thanks to Wilson Ho.)
1357 - CORD_str failed if the substring occurred at the last possible position.
1358 (Only affects cord users.)
1359 - Fixed Linux code to deal with RedHat 5.0 and integrated Peter Bigot's
1360 os_dep.c code for dealing with various Linux versions.
1361 - Added workaround for Irix pthreads sigaction bug and possible signal
1362 misdirection problems.
1364 - Changed RS6000 STACKBOTTOM.
1365 - Integrated Patrick Beard's Mac changes.
1366 - Alpha1 didn't compile on Irix m.n, m < 6.
1367 - Replaced Makefile.dj with a new one from Gary Leavens.
1368 - Added Andrew Stitcher's changes to support SCO OpenServer.
1369 - Added PRINT_BLACK_LIST, to allow debugging of high densities of false
1371 - Added code to debug allocator to keep track of return address
1372 in GC_malloc caller, thus giving a bit more context.
1373 - Changed default behavior of large block allocator to more
1374 aggressively avoid fragmentation. This is likely to slow down the
1375 collector when it succeeds at reducing space cost.
1376 - Integrated Fergus Henderson's CYGWIN32 changes. They are untested,
1377 but needed for newer versions.
1378 - USE_MMAP had some serious bugs. This caused the collector to fail
1379 consistently on Solaris with -DSMALL_CONFIG.
1380 - Added Linux threads support, thanks largely to Fergus Henderson.
1382 - Fixed more Linux threads problems.
1383 - Changed default GC_free_space_divisor to 3 with new large block allocation.
1384 (Thanks to Matthew Flatt for some measurements that suggest the old
1385 value sometimes favors space too much over time.)
1386 - More CYGWIN32 fixes.
1387 - Integrated Tyson-Dowd's Linux-M68K port.
1388 - Minor HP PA and DEC UNIX fixes from Fergus Henderson.
1389 - Integrated Christoffe Raffali's Linux-SPARC changes.
1390 - Allowed for one more GC fixup iteration after a full GC in incremental
1391 mode. Some quick measurements suggested that this significantly
1392 reduces pause times even with smaller GC_RATE values.
1393 - Moved some more GC data structures into GC_arrays. This decreases
1394 pause times and GC overhead, but makes debugging slightly less convenient.
1395 - Fixed namespace pollution problem ("excl_table").
1396 - Made GC_incremental a constant for -DSMALL_CONFIG, hopefully shrinking
1398 - Added some win32 threads fixes.
1399 - Integrated Ivan Demakov and David Stes' Watcom fixes.
1400 - Various other minor fixes contributed by many people.
1401 - Renamed config.h to gcconfig.h, since config.h tends to be used for
1403 - Integrated Matthew Flatt's support for 68K MacOS "far globals".
1404 - Fixed up some of the dynamic library Makefile targets for consistency
1406 - Fixed a USE_MMAP typo that caused out-of-memory handling to fail
1408 - Added code to test.c to test thread creation a bit more.
1409 - Integrated GC_win32_free_heap, as suggested by Ivan Demakov.
1410 - Fixed Solaris 2.7 stack base finding problem. (This may actually
1411 have been done in an earlier alpha release.)
1413 - Fixed MSWIN32 recognition test, which interfered with cygwin.
1414 - Removed unnecessary gc_watcom.asm from distribution. Removed
1415 some obsolete README.win32 text.
1416 - Added Alpha Linux incremental GC support. (Thanks to Philipp Tomsich
1417 for code for retrieving the fault address in a signal handler.)
1418 Changed Linux signal handler context argument to be a pointer.
1419 - Took care of some new warnings generated by the 7.3 SGI compiler.
1420 - Integrated Phillip Musumeci's FreeBSD/ELF fixes.
1421 - -DIRIX_THREADS was broken with the -o32 ABI (typo in gc_priv.h>
1424 - Fixed GC_print_source_ptr to not use a prototype.
1425 - generalized CYGWIN test.
1426 - gc::new did the wrong thing with PointerFreeGC placement.
1427 (Thanks to Rauli Ruohonen.)
1428 - In the ALL_INTERIOR_POINTERS (default) case, some callee-save register
1429 values could fail to be scanned if the register was saved and
1430 reused in a GC frame. This showed up in verbose mode with gctest
1431 compiled with an unreleased SGI compiler. I vaguely recall an old
1432 bug report that may have been related. The bug was probably quite old.
1433 (The problem was that the stack scanning could be deferred until
1434 after the relevant frame was overwritten, and the new save location
1435 might be outside the scanned area. Fixed by more eager stack scanning.)
1436 - PRINT_BLACK_LIST had some problems. A few source addresses were garbage.
1437 - Replaced Makefile.dj and added -I flags to cord make targets.
1438 (Thanks to Gary Leavens.)
1439 - GC_try_to_collect was broken with the nonincremental collector.
1440 - gc_cleanup destructors could pass the wrong address to
1441 GC_register_finalizer_ignore_self in the presence of multiple
1442 inheritance. (Thanks to Darrell Schiebel.)
1443 - Changed PowerPC Linux stack finding code.
1446 - -DSMALL_CONFIG did not work reliably with large (> 4K) pages.
1447 Recycling the mark stack during expansion could result in a size
1448 zero heap segment, which confused things. (This was probably also an
1449 issue with the normal config and huge pages.)
1450 - Did more work to make sure that callee-save registers were scanned
1451 completely, even with the setjmp-based code. Added USE_GENERIC_PUSH_REGS
1452 macro to facilitate testing on machines I have access to.
1453 - Added code to explicitly push register contents for win32 threads.
1454 This seems to be necessary. (Thanks to Pierre de Rop.)
1457 - changed STACKBOTTOM for DJGPP (Thanks to Salvador Eduardo Tropea).
1460 - Reworked large block allocator. Now uses multiple doubly linked free
1461 lists to approximate best fit.
1462 - Changed heap expansion heuristic. Entirely free blocks are no longer
1463 counted towards the heap size. This seems to have a major impact on
1464 heap size stability; the old version could expand the heap way too
1465 much in the presence of large block fragmentation.
1466 - added -DGC_ASSERTIONS and some simple assertions inside the collector.
1467 This is mainlyt for collector debugging.
1468 - added -DUSE_MUNMAP to allow the heap to shrink. Suupported on only
1469 a few UNIX-like platforms for now.
1470 - added GC_dump_regions() for debugging of fragmentation issues.
1471 - Changed PowerPC pointer alignment under Linux to 4. (This needs
1472 checking by someone who has one. The suggestions came to me via a
1473 rather circuitous path.)
1474 - Changed the Linux/Alpha port to walk the data segment backwards until
1475 it encounters a SIGSEGV. The old way to find the start of the data
1476 segment broke with a recent release.
1477 - cordxtra.c needed to call GC_REGISTER_FINALIZER instead of
1478 GC_register_finalizer, so that it would continue to work with GC_DEBUG.
1479 - allochblk sometimes cleared the wrong block for debugging purposes
1480 when it dropped blacklisted blocks. This could result in spurious
1481 error reports with GC_DEBUG.
1482 - added MACOS X Server support. (Thanks to Andrew Stone.)
1483 - Changed the Solaris threads code to ignore stack limits > 8 MB with
1484 a warning. Empirically, it is not safe to access arbitrary pages
1485 in such large stacks. And the dirty bit implementation does not
1486 guarantee that none of them will be accessed.
1487 - Integrated Martin Tauchmann's Amiga changes.
1488 - Integrated James Dominy's OpenBSD/SPARC port.
1491 - Fixed bugs introduced in alpha1 (OpenBSD & large block initialization).
1492 - Added -DKEEP_BACK_PTRS and backptr.h interface. (The implementation
1493 idea came from Al Demers.)
1496 - Added some highly incomplete code to support a copied young generation.
1497 Comments on nursery.h are appreciated.
1498 - Changed -DFIND_LEAK, -DJAVA_FINALIZATION, and -DFINALIZE_ON_DEMAND,
1499 so the same effect could be obtained with a runtime switch. This is
1500 a step towards standardizing on a single dynamic GC library.
1501 - Significantly changed the way leak detection is handled, as a consequence
1505 - Added protection fault handling patch for Linux/M68K from Fergus
1506 Henderson and Roman Hodek.
1507 - Removed the tests for SGI_SOURCE in new_gc_alloc.h. This was causing that
1508 interface to fail on nonSGI platforms.
1509 - Changed the Linux stack finding code to use /proc, after changing it
1510 to use HEURISTIC1. (Thanks to David Mossberger for pointing out the
1512 - Added HP/UX incremental GC support and HP/UX 11 thread support.
1513 Thread support is currently still flakey.
1514 - Added basic Linux/IA64 support.
1515 - Integrated Anthony Green's PicoJava support.
1516 - Integrated Scott Ananian's StrongARM/NetBSD support.
1517 - Fixed some fairly serious performance bugs in the incremental
1518 collector. These have probably been there essentially forever.
1519 (Mark bits were sometimes set before scanning dirty pages.
1520 The reclaim phase unnecessarily dirtied full small object pages.)
1521 - Changed the reclaim phase to ignore nearly full pages to avoid
1523 - Limited GC_black_list_spacing to roughly the heap growth increment.
1524 - Changed full collection triggering heuristic to decrease full GC
1525 frequency by default, but to explicitly trigger full GCs during
1526 heap growth. This doesn't always improve things, but on average it's
1528 - GC_debug_free(0, ...) failed. Thanks to Fergus Henderson for the
1532 - GC_malloc_explicitly_typed and friends sometimes failed to
1533 initialize first word.
1534 - Added allocation routines and support in the marker for mark descriptors
1535 in a type structure referenced by the first word of an object. This was
1536 introduced to support gcj, but hopefully in a way that makes it
1538 - Added GC_requested_heapsize, and inhibited collections in nonincremental
1539 mode if the actual used heap size is less than what was explicitly
1541 - The Solaris pthreads version of GC_pthread_create didn't handle a NULL
1542 attribute pointer. Solaris thread support used the wrong default thread
1543 stack size. (Thanks to Melissa O'Neill for the patch.)
1544 - Changed PUSH_CONTENTS macro to no longer modify first parameter.
1545 This usually doesn't matter, but it was certainly an accident waiting
1547 - Added GC_register_finalizer_no_order and friends to gc.h. They're
1548 needed by Java implementations.
1549 - Integrated a fix for a win32 deadlock resulting from clock() calling
1550 malloc. (Thanks to Chris Dodd.)
1551 - Integrated Hiroshi Kawashima's port to Linux/MIPS. This was designed
1552 for a handheld platform, and may or may not be sufficient for other
1554 - Fixed a va_arg problem with the %c specifier in cordprnt.c. It appears
1555 that this was always broken, but recent versions of gcc are the first to
1556 report the (statically detectable) bug.
1557 - Added an attempt at a more general solution to dlopen races/deadlocks.
1558 GC_dlopen now temporarily disables collection. Still not ideal, but ...
1559 - Added -DUSE_I686_PREFETCH, -DUSE_3DNOW_PREFETCH, and support for IA64
1560 prefetch instructions. May improve performance measurably, but I'm not
1561 sure the code will run correctly on processors that don't support the
1562 instruction. Won't build except with very recent gcc.
1563 - Added caching for header lookups in the marker. This seems to result
1564 in a barely measurable performance gain. Added support for interleaved
1565 lookups of two pointers, but unconfigured that since the performance
1566 gain is currently near zero, and it adds to code size.
1567 - Changed Linux DATA_START definition to check both data_start and
1568 __data_start, since nothing else seems to be portable.
1569 - Added -DUSE_LD_WRAP to optionally take advantage of the GNU ld function
1570 wrapping mechanism. Probably currently useful only on Linux.
1571 - Moved some variables for the scratch allocator into GC_arrays, on
1572 Martin Hirzel's suggestion.
1573 - Fixed a win32 threads bug that caused the collector to not look for
1574 interior pointers from one of the thread stacks without
1575 ALL_INTERIOR_POINTERS. (Thanks to Jeff Sturm.)
1576 - Added Mingw32 support. (Thanks again to Jeff Sturm for the patch.)
1577 - Changed the alpha port to use the generic register scanning code instead
1578 of alpha_mach_dep.s. Alpha_mach_dep.s doesn't look for pointers in fp
1579 registers, but gcc sometimes spills pointers there. (Thanks to Manuel
1580 Serrano for helping me debug this by email.) Changed the IA64 code to
1581 do something similar for similar reasons.
1584 - -DREDIRECT_MALLOC was broken in alpha6. Fixed.
1585 - Cleaned up gc_ccp.h slightly, thus also causing the HP C++ compiler to
1587 - Removed accidental reference to dbg_mlc.c, which caused dbg_mlc.o to be
1588 linked into every executable.
1589 - Added PREFETCH to bitmap marker. Changed it to use the header cache.
1590 - GC_push_marked sometimes pushed one object too many, resulting in a
1591 segmentation fault in GC_mark_from_mark_stack. This was probably an old
1592 bug. It finally showed up in gctest on win32.
1593 - Gc_priv.h erroneously #defined GC_incremental to be TRUE instead of FALSE
1594 when SMALL_CONFIG was defined. This was no doubt a major performance bug for
1595 the default win32 configuration.
1596 - Removed -DSMALL_CONFIG from NT_MAKEFILE. It seemed like an anchronism now
1597 that the average PC has 64MB or so.
1598 - Integrated Bryce McKinley's patches for linux threads and dynamic loading
1599 from the libgcj tree. Turned on dynamic loading support for Linux/PPC.
1600 - Changed the stack finding code to use environ on HP/UX. (Thanks
1601 to Gustavo Rodriguez-Rivera for the suggestion.) This should probably
1602 be done on other platforms, too. Since I can't test those, that'll
1603 wait until after 5.0.
1606 - Fixed threadlibs.c for linux threads. -DUSE_LD_WRAP was broken and
1607 -ldl was omitted. Fixed Linux stack finding code to handle
1608 -DUSE_LD_WRAP correctly.
1609 - Added MSWIN32 exception handler around marker, so that the collector
1610 can recover from root segments that are unmapped during the collection.
1611 This caused occasional failures under Windows 98, and may also be
1612 an issue under Windows NT/2000.
1615 - Fixed a gc.h header bug which showed up under Irix. (Thanks to
1617 - Fixed a typo in GC_double_descr in typd_mlc.c not getting traced correctly.
1618 This probably could result in objects described by array descriptors not
1619 getting traced correctly. (Thanks to Ben Hutchings for pointing this out.)
1620 - The block nearly full tests in reclaim.c were not correct for 64 bit
1621 environments. This could result in unnecessary heap growth under unlikely
1623 - Removed use of CLEAR_DOUBLE from generic reclaim code, since odd sizes
1627 - Integrate Linux/SPARC fixes.
1628 - Very large root set sizes (> 16 MB or so) could cause the collector
1629 to abort with an unexpected mark stack overflow. (Thanks again to
1630 Peter Chubb.) NOT YET FIXED. Workaround is to increase the initial
1632 - The SGI version of the collector marks from mmapped pages, even
1633 if they are not part of dynamic library static data areas. This
1634 causes performance problems with some SGI libraries that use mmap
1635 as a bitmap allocator. NOT YET FIXED. It may be possible to turn
1636 off DYNAMIC_LOADING in the collector as a workaround. It may also
1637 be possible to conditionally intercept mmap and use GC_exclude_static_roots.
1638 The real fix is to walk rld data structures, which looks possible.
1639 - Integrate MIT and DEC pthreads ports.
1640 - Incremental collector should handle large objects better. Currently,
1641 it looks like the whole object is treated as dirty if any part of it
1643 - Cord/cordprnt.c doesn't build on a few platforms (notably PowerPC), since
1644 we make some unwarranted assumptions about how varargs are handled. This
1645 currently makes the cord-aware versions of printf unusable on some platforms.
1646 Fixing this is unfortunately not trivial.