[BACK]Return to README CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / gc

Annotation of OpenXM_contrib2/asir2000/gc/README, Revision 1.2

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>