implemented Setup.hs to build boehm cpp libs and install them;
[hs-boehmgc.git] / gc-7.2 / doc / README
1 Copyright (c) 1988, 1989 Hans-J. Boehm, Alan J. Demers
2 Copyright (c) 1991-1996 by Xerox Corporation.  All rights reserved.
3 Copyright (c) 1996-1999 by Silicon Graphics.  All rights reserved.
4 Copyright (c) 1999-2011 by Hewlett-Packard Development Company.
5
6 The file linux_threads.c is also
7 Copyright (c) 1998 by Fergus Henderson.  All rights reserved.
8
9 The files Makefile.am, and configure.in are
10 Copyright (c) 2001 by Red Hat Inc. All rights reserved.
11
12 Several files supporting GNU-style builds are copyrighted by the Free
13 Software Foundation, and carry a different license from that given
14 below.  The files included in the libatomic_ops distribution (included
15 here) use either the license below, or a similar MIT-style license,
16 or, for some files not actually used by the garbage-collector library, the
17 GPL.
18
19 THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
20 OR IMPLIED.  ANY USE IS AT YOUR OWN RISK.
21
22 Permission is hereby granted to use or copy this program
23 for any purpose,  provided the above notices are retained on all copies.
24 Permission to modify the code and to distribute modified code is granted,
25 provided the above notices are retained, and a notice that the code was
26 modified is included with the above copyright notice.
27
28 A few of the files needed to use the GNU-style build procedure come with
29 slightly different licenses, though they are all similar in spirit.  A few
30 are GPL'ed, but with an exception that should cover all uses in the
31 collector. (If you are concerned about such things, I recommend you look
32 at the notice in config.guess or ltmain.sh.)
33
34 The atomic_ops library contains some code that is covered by the GNU General
35 Public License, but is not needed by, nor linked into the collector library.
36 It is included here only because the atomic_ops distribution is, for
37 simplicity, included in its entirety.
38
39 This is version 7.2d of a conservative garbage collector for C and C++.
40
41 You might find a more recent version of this at
42
43 http://www.hpl.hp.com/personal/Hans_Boehm/gc
44
45 OVERVIEW
46
47     This is intended to be a general purpose, garbage collecting storage
48 allocator.  The algorithms used are described in:
49
50 Boehm, H., and M. Weiser, "Garbage Collection in an Uncooperative Environment",
51 Software Practice & Experience, September 1988, pp. 807-820.
52
53 Boehm, H., A. Demers, and S. Shenker, "Mostly Parallel Garbage Collection",
54 Proceedings of the ACM SIGPLAN '91 Conference on Programming Language Design
55 and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164.
56
57 Boehm, H., "Space Efficient Conservative Garbage Collection", Proceedings
58 of the ACM SIGPLAN '91 Conference on Programming Language Design and
59 Implementation, SIGPLAN Notices 28, 6 (June 1993), pp. 197-206.
60
61 Boehm H., "Reducing Garbage Collector Cache Misses", Proceedings of the
62 2000 International Symposium on Memory Management.
63
64   Possible interactions between the collector and optimizing compilers are
65 discussed in
66
67 Boehm, H., and D. Chase, "A Proposal for GC-safe C Compilation",
68 The Journal of C Language Translation 4, 2 (December 1992).
69
70 and
71
72 Boehm H., "Simple GC-safe Compilation", Proceedings
73 of the ACM SIGPLAN '96 Conference on Programming Language Design and
74 Implementation.
75
76 (Some of these are also available from
77 http://www.hpl.hp.com/personal/Hans_Boehm/papers/, among other places.)
78
79   Unlike the collector described in the second reference, this collector
80 operates either with the mutator stopped during the entire collection
81 (default) or incrementally during allocations.  (The latter is supported
82 on fewer machines.)  On the most common platforms, it can be built
83 with or without thread support.  On a few platforms, it can take advantage
84 of a multiprocessor to speed up garbage collection.
85
86   Many of the ideas underlying the collector have previously been explored
87 by others.  Notably, some of the run-time systems developed at Xerox PARC
88 in the early 1980s conservatively scanned thread stacks to locate possible
89 pointers (cf. Paul Rovner, "On Adding Garbage Collection and Runtime Types
90 to a Strongly-Typed Statically Checked, Concurrent Language"  Xerox PARC
91 CSL 84-7).  Doug McIlroy wrote a simpler fully conservative collector that
92 was part of version 8 UNIX (tm), but appears to not have received
93 widespread use.
94
95   Rudimentary tools for use of the collector as a leak detector are included
96 (see http://www.hpl.hp.com/personal/Hans_Boehm/gc/leak.html),
97 as is a fairly sophisticated string package "cord" that makes use of the
98 collector.  (See doc/README.cords and H.-J. Boehm, R. Atkinson, and M. Plass,
99 "Ropes: An Alternative to Strings", Software Practice and Experience 25, 12
100 (December 1995), pp. 1315-1330.  This is very similar to the "rope" package
101 in Xerox Cedar, or the "rope" package in the SGI STL or the g++ distribution.)
102
103 Further collector documentation can be found at
104
105 http://www.hpl.hp.com/personal/Hans_Boehm/gc
106
107
108 GENERAL DESCRIPTION
109
110   This is a garbage collecting storage allocator that is intended to be
111 used as a plug-in replacement for C's malloc.
112
113   Since the collector does not require pointers to be tagged, it does not
114 attempt to ensure that all inaccessible storage is reclaimed.  However,
115 in our experience, it is typically more successful at reclaiming unused
116 memory than most C programs using explicit deallocation.  Unlike manually
117 introduced leaks, the amount of unreclaimed memory typically stays
118 bounded.
119
120   In the following, an "object" is defined to be a region of memory allocated
121 by the routines described below.
122
123   Any objects not intended to be collected must be pointed to either
124 from other such accessible objects, or from the registers,
125 stack, data, or statically allocated bss segments.  Pointers from
126 the stack or registers may point to anywhere inside an object.
127 The same is true for heap pointers if the collector is compiled with
128 ALL_INTERIOR_POINTERS defined, or GC_all_interior_pointers is otherwise
129 set, as is now the default.
130
131 Compiling without ALL_INTERIOR_POINTERS may reduce accidental retention
132 of garbage objects, by requiring pointers from the heap to the beginning
133 of an object.  But this no longer appears to be a significant
134 issue for most programs occupying a small fraction of the possible
135 address space.
136
137 There are a number of routines which modify the pointer recognition
138 algorithm.  GC_register_displacement allows certain interior pointers
139 to be recognized even if ALL_INTERIOR_POINTERS is nor defined.
140 GC_malloc_ignore_off_page allows some pointers into the middle of large objects
141 to be disregarded, greatly reducing the probability of accidental
142 retention of large objects.  For most purposes it seems best to compile
143 with ALL_INTERIOR_POINTERS and to use GC_malloc_ignore_off_page if
144 you get collector warnings from allocations of very large objects.
145 See README.debugging for details.
146
147   WARNING: pointers inside memory allocated by the standard "malloc" are not
148 seen by the garbage collector.  Thus objects pointed to only from such a
149 region may be prematurely deallocated.  It is thus suggested that the
150 standard "malloc" be used only for memory regions, such as I/O buffers, that
151 are guaranteed not to contain pointers to garbage collectable memory.
152 Pointers in C language automatic, static, or register variables,
153 are correctly recognized.  (Note that GC_malloc_uncollectable has semantics
154 similar to standard malloc, but allocates objects that are traced by the
155 collector.)
156
157   WARNING: the collector does not always know how to find pointers in data
158 areas that are associated with dynamic libraries.  This is easy to
159 remedy IF you know how to find those data areas on your operating
160 system (see GC_add_roots).  Code for doing this under SunOS, IRIX 5.X and 6.X,
161 HP/UX, Alpha OSF/1, Linux, and win32 is included and used by default.  (See
162 README.win32 for win32 details.)  On other systems pointers from dynamic
163 library data areas may not be considered by the collector.
164 If you're writing a program that depends on the collector scanning
165 dynamic library data areas, it may be a good idea to include at least
166 one call to GC_is_visible() to ensure that those areas are visible
167 to the collector.
168
169   Note that the garbage collector does not need to be informed of shared
170 read-only data.  However if the shared library mechanism can introduce
171 discontiguous data areas that may contain pointers, then the collector does
172 need to be informed.
173
174   Signal processing for most signals may be deferred during collection,
175 and during uninterruptible parts of the allocation process.
176 Like standard ANSI C mallocs, by default it is unsafe to invoke
177 malloc (and other GC routines) from a signal handler while another
178 malloc call may be in progress. Removing -DNO_SIGNALS from Makefile
179 attempts to remedy that.  But that may not be reliable with a compiler that
180 substantially reorders memory operations inside GC_malloc.
181
182   The allocator/collector can also be configured for thread-safe operation.
183 (Full signal safety can also be achieved, but only at the cost of two system
184 calls per malloc, which is usually unacceptable.)
185 WARNING: the collector does not guarantee to scan thread-local storage
186 (e.g. of the kind accessed with pthread_getspecific()).  The collector
187 does scan thread stacks, though, so generally the best solution is to
188 ensure that any pointers stored in thread-local storage are also
189 stored on the thread's stack for the duration of their lifetime.
190 (This is arguably a longstanding bug, but it hasn't been fixed yet.)
191
192 INSTALLATION AND PORTABILITY
193
194   As distributed, the collector operates silently
195 In the event of problems, this can usually be changed by defining the
196 GC_PRINT_STATS or GC_PRINT_VERBOSE_STATS environment variables.  This
197 will result in a few lines of descriptive output for each collection.
198 (The given statistics exhibit a few peculiarities.
199 Things don't appear to add up for a variety of reasons, most notably
200 fragmentation losses.  These are probably much more significant for the
201 contrived program "test.c" than for your application.)
202
203   On most Un*x-like platforms, the collector can be built either using a
204 GNU autoconf-based build infrastructure (type "configure; make" in the
205 simplest case), or with a classic makefile by itself (type
206 "cp Makefile.direct Makefile; make").  Here we focus on the latter option.
207 On other platforms, typically only the latter option is available, though
208 with a different supplied Makefile.)
209
210   For the Makefile.direct-based process, typing "make test" instead of "make"
211 will automatically build the collector and then run setjmp_test and gctest.
212 Setjmp_test will give you information about configuring the collector, which is
213 useful primarily if you have a machine that's not already supported.  Gctest is
214 a somewhat superficial test of collector functionality.  Failure is indicated
215 by a core dump or a message to the effect that the collector is broken.  Gctest
216 takes about a second to two to run on reasonable 2007 vintage desktops.  It may
217 use up to about 30MB of memory.  (The multi-threaded version will use more.
218 64-bit versions may use more.) "Make test" will also, as its last step, attempt
219 to build and test the "cord" string library.)
220
221   Makefile.direct will generate a library gc.a which you should link against.
222 Typing "make cords" will add the cord library to gc.a.
223
224   The GNU style build process understands the usual targets.  "Make check"
225 runs a number of tests.  "Make install" installs at least libgc, and libcord.
226 Try "./configure --help" to see the configuration options.  It is currently
227 not possible to exercise all combinations of build options this way.
228
229   It is suggested that if you need to replace a piece of the collector
230 (e.g. GC_mark_rts.c) you simply list your version ahead of gc.a on the
231 ld command line, rather than replacing the one in gc.a.  (This will
232 generate numerous warnings under some versions of AIX, but it still
233 works.)
234
235   All include files that need to be used by clients will be put in the
236 include subdirectory.  (Normally this is just gc.h.  "Make cords" adds
237 "cord.h" and "ec.h".)
238
239   The collector currently is designed to run essentially unmodified on
240 machines that use a flat 32-bit or 64-bit address space.
241 That includes the vast majority of Workstations and X86 (X >= 3) PCs.
242 (The list here was deleted because it was getting too long and constantly
243 out of date.)
244
245   In a few cases (Amiga, OS/2, Win32, MacOS) a separate makefile
246 or equivalent is supplied.  Many of these have separate README.system
247 files.
248
249   Dynamic libraries are completely supported only under SunOS/Solaris,
250 (and even that support is not functional on the last Sun 3 release),
251 Linux, FreeBSD, NetBSD, IRIX 5&6, HP/UX, Win32 (not Win32S) and OSF/1
252 on DEC AXP machines plus perhaps a few others listed near the top
253 of dyn_load.c.  On other machines we recommend that you do one of
254 the following:
255
256   1) Add dynamic library support (and send us the code).
257   2) Use static versions of the libraries.
258   3) Arrange for dynamic libraries to use the standard malloc.
259      This is still dangerous if the library stores a pointer to a
260      garbage collected object.  But nearly all standard interfaces
261      prohibit this, because they deal correctly with pointers
262      to stack allocated objects.  (Strtok is an exception.  Don't
263      use it.)
264
265   In all cases we assume that pointer alignment is consistent with that
266 enforced by the standard C compilers.  If you use a nonstandard compiler
267 you may have to adjust the alignment parameters defined in gc_priv.h.
268 Note that this may also be an issue with packed records/structs, if those
269 enforce less alignment for pointers.
270
271   A port to a machine that is not byte addressed, or does not use 32 bit
272 or 64 bit addresses will require a major effort.  A port to plain MSDOS
273 or win16 is hard.
274
275   For machines not already mentioned, or for nonstandard compilers,
276 some porting suggestions are provided in the "porting.html" file.
277
278 THE C INTERFACE TO THE ALLOCATOR
279
280   The following routines are intended to be directly called by the user.
281 Note that usually only GC_malloc is necessary.  GC_clear_roots and GC_add_roots
282 calls may be required if the collector has to trace from nonstandard places
283 (e.g. from dynamic library data areas on a machine on which the
284 collector doesn't already understand them.)  On some machines, it may
285 be desirable to set GC_stacktop to a good approximation of the stack base.
286 (This enhances code portability on HP PA machines, since there is no
287 good way for the collector to compute this value.)  Client code may include
288 "gc.h", which defines all of the following, plus many others.
289
290 1)  GC_malloc(nbytes)
291     - allocate an object of size nbytes.  Unlike malloc, the object is
292       cleared before being returned to the user.  Gc_malloc will
293       invoke the garbage collector when it determines this to be appropriate.
294       GC_malloc may return 0 if it is unable to acquire sufficient
295       space from the operating system.  This is the most probable
296       consequence of running out of space.  Other possible consequences
297       are that a function call will fail due to lack of stack space,
298       or that the collector will fail in other ways because it cannot
299       maintain its internal data structures, or that a crucial system
300       process will fail and take down the machine.  Most of these
301       possibilities are independent of the malloc implementation.
302
303 2)  GC_malloc_atomic(nbytes)
304     - allocate an object of size nbytes that is guaranteed not to contain any
305       pointers.  The returned object is not guaranteed to be cleared.
306       (Can always be replaced by GC_malloc, but results in faster collection
307       times.  The collector will probably run faster if large character
308       arrays, etc. are allocated with GC_malloc_atomic than if they are
309       statically allocated.)
310
311 3)  GC_realloc(object, new_size)
312     - change the size of object to be new_size.  Returns a pointer to the
313       new object, which may, or may not, be the same as the pointer to
314       the old object.  The new object is taken to be atomic iff the old one
315       was.  If the new object is composite and larger than the original object,
316       then the newly added bytes are cleared (we hope).  This is very likely
317       to allocate a new object, unless MERGE_SIZES is defined in gc_priv.h.
318       Even then, it is likely to recycle the old object only if the object
319       is grown in small additive increments (which, we claim, is generally bad
320       coding practice.)
321
322 4)  GC_free(object)
323     - explicitly deallocate an object returned by GC_malloc or
324       GC_malloc_atomic.  Not necessary, but can be used to minimize
325       collections if performance is critical.  Probably a performance
326       loss for very small objects (<= 8 bytes).
327
328 5)  GC_expand_hp(bytes)
329     - Explicitly increase the heap size.  (This is normally done automatically
330       if a garbage collection failed to GC_reclaim enough memory.  Explicit
331       calls to GC_expand_hp may prevent unnecessarily frequent collections at
332       program startup.)
333
334 6)  GC_malloc_ignore_off_page(bytes)
335         - identical to GC_malloc, but the client promises to keep a pointer to
336           the somewhere within the first 256 bytes of the object while it is
337           live.  (This pointer should normally be declared volatile to prevent
338           interference from compiler optimizations.)  This is the recommended
339           way to allocate anything that is likely to be larger than 100Kbytes
340           or so.  (GC_malloc may result in failure to reclaim such objects.)
341
342 7)  GC_set_warn_proc(proc)
343         - Can be used to redirect warnings from the collector.  Such warnings
344           should be rare, and should not be ignored during code development.
345
346 8) GC_enable_incremental()
347     - Enables generational and incremental collection.  Useful for large
348       heaps on machines that provide access to page dirty information.
349       Some dirty bit implementations may interfere with debugging
350       (by catching address faults) and place restrictions on heap arguments
351       to system calls (since write faults inside a system call may not be
352       handled well).
353
354 9) Several routines to allow for registration of finalization code.
355    User supplied finalization code may be invoked when an object becomes
356    unreachable.  To call (*f)(obj, x) when obj becomes inaccessible, use
357         GC_register_finalizer(obj, f, x, 0, 0);
358    For more sophisticated uses, and for finalization ordering issues,
359    see gc.h.
360
361   The global variable GC_free_space_divisor may be adjusted up from its
362 default value of 4 to use less space and more collection time, or down for
363 the opposite effect.  Setting it to 1 or 0 will effectively disable collections
364 and cause all allocations to simply grow the heap.
365
366   The variable GC_non_gc_bytes, which is normally 0, may be changed to reflect
367 the amount of memory allocated by the above routines that should not be
368 considered as a candidate for collection.  Careless use may, of course, result
369 in excessive memory consumption.
370
371   Some additional tuning is possible through the parameters defined
372 near the top of gc_priv.h.
373
374   If only GC_malloc is intended to be used, it might be appropriate to define:
375
376 #define malloc(n) GC_malloc(n)
377 #define calloc(m,n) GC_malloc((m)*(n))
378
379   For small pieces of VERY allocation intensive code, gc_inl.h
380 includes some allocation macros that may be used in place of GC_malloc
381 and friends.
382
383   All externally visible names in the garbage collector start with "GC_".
384 To avoid name conflicts, client code should avoid this prefix, except when
385 accessing garbage collector routines or variables.
386
387   There are provisions for allocation with explicit type information.
388 This is rarely necessary.  Details can be found in gc_typed.h.
389
390 THE C++ INTERFACE TO THE ALLOCATOR:
391
392   The Ellis-Hull C++ interface to the collector is included in
393 the collector distribution.  If you intend to use this, type
394 "make c++" after the initial build of the collector is complete.
395 See gc_cpp.h for the definition of the interface.  This interface
396 tries to approximate the Ellis-Detlefs C++ garbage collection
397 proposal without compiler changes.
398
399   Very often it will also be necessary to use gc_allocator.h and the
400 allocator declared there to construct STL data structures.  Otherwise
401 subobjects of STL data structures will be allocated using a system
402 allocator, and objects they refer to may be prematurely collected.
403
404 USE AS LEAK DETECTOR:
405
406   The collector may be used to track down leaks in C programs that are
407 intended to run with malloc/free (e.g. code with extreme real-time or
408 portability constraints).  To do so define FIND_LEAK in Makefile
409 This will cause the collector to invoke the report_leak
410 routine defined near the top of reclaim.c whenever an inaccessible
411 object is found that has not been explicitly freed.  Such objects will
412 also be automatically reclaimed.
413   If all objects are allocated with GC_DEBUG_MALLOC (see next section), then
414 the default version of report_leak will report at least the source file and
415 line number at which the leaked object was allocated.  This may sometimes be
416 sufficient.  (On a few machines, it will also report a cryptic stack trace.
417 If this is not symbolic, it can sometimes be called into a sympolic stack
418 trace by invoking program "foo" with "callprocs foo".  Callprocs is a short
419 shell script that invokes adb to expand program counter values to symbolic
420 addresses.  It was largely supplied by Scott Schwartz.)
421   Note that the debugging facilities described in the next section can
422 sometimes be slightly LESS effective in leak finding mode, since in
423 leak finding mode, GC_debug_free actually results in reuse of the object.
424 (Otherwise the object is simply marked invalid.)  Also note that the test
425 program is not designed to run meaningfully in FIND_LEAK mode.
426 Use "make gc.a" to build the collector.
427
428 DEBUGGING FACILITIES:
429
430   The routines GC_debug_malloc, GC_debug_malloc_atomic, GC_debug_realloc,
431 and GC_debug_free provide an alternate interface to the collector, which
432 provides some help with memory overwrite errors, and the like.
433 Objects allocated in this way are annotated with additional
434 information.  Some of this information is checked during garbage
435 collections, and detected inconsistencies are reported to stderr.
436
437   Simple cases of writing past the end of an allocated object should
438 be caught if the object is explicitly deallocated, or if the
439 collector is invoked while the object is live.  The first deallocation
440 of an object will clear the debugging info associated with an
441 object, so accidentally repeated calls to GC_debug_free will report the
442 deallocation of an object without debugging information.  Out of
443 memory errors will be reported to stderr, in addition to returning NULL.
444
445   GC_debug_malloc checking  during garbage collection is enabled
446 with the first call to GC_debug_malloc.  This will result in some
447 slowdown during collections.  If frequent heap checks are desired,
448 this can be achieved by explicitly invoking GC_gcollect, e.g. from
449 the debugger.
450
451   GC_debug_malloc allocated objects should not be passed to GC_realloc
452 or GC_free, and conversely.  It is however acceptable to allocate only
453 some objects with GC_debug_malloc, and to use GC_malloc for other objects,
454 provided the two pools are kept distinct.  In this case, there is a very
455 low probability that GC_malloc allocated objects may be misidentified as
456 having been overwritten.  This should happen with probability at most
457 one in 2**32.  This probability is zero if GC_debug_malloc is never called.
458
459   GC_debug_malloc, GC_malloc_atomic, and GC_debug_realloc take two
460 additional trailing arguments, a string and an integer.  These are not
461 interpreted by the allocator.  They are stored in the object (the string is
462 not copied).  If an error involving the object is detected, they are printed.
463
464   The macros GC_MALLOC, GC_MALLOC_ATOMIC, GC_REALLOC, GC_FREE, and
465 GC_REGISTER_FINALIZER are also provided.  These require the same arguments
466 as the corresponding (nondebugging) routines.  If gc.h is included
467 with GC_DEBUG defined, they call the debugging versions of these
468 functions, passing the current file name and line number as the two
469 extra arguments, where appropriate.  If gc.h is included without GC_DEBUG
470 defined, then all these macros will instead be defined to their nondebugging
471 equivalents.  (GC_REGISTER_FINALIZER is necessary, since pointers to
472 objects with debugging information are really pointers to a displacement
473 of 16 bytes form the object beginning, and some translation is necessary
474 when finalization routines are invoked.  For details, about what's stored
475 in the header, see the definition of the type oh in debug_malloc.c)
476
477 INCREMENTAL/GENERATIONAL COLLECTION:
478
479 The collector normally interrupts client code for the duration of
480 a garbage collection mark phase.  This may be unacceptable if interactive
481 response is needed for programs with large heaps.  The collector
482 can also run in a "generational" mode, in which it usually attempts to
483 collect only objects allocated since the last garbage collection.
484 Furthermore, in this mode, garbage collections run mostly incrementally,
485 with a small amount of work performed in response to each of a large number of
486 GC_malloc requests.
487
488 This mode is enabled by a call to GC_enable_incremental().
489
490 Incremental and generational collection is effective in reducing
491 pause times only if the collector has some way to tell which objects
492 or pages have been recently modified.  The collector uses two sources
493 of information:
494
495 1. Information provided by the VM system.  This may be provided in
496 one of several forms.  Under Solaris 2.X (and potentially under other
497 similar systems) information on dirty pages can be read from the
498 /proc file system.  Under other systems (currently SunOS4.X) it is
499 possible to write-protect the heap, and catch the resulting faults.
500 On these systems we require that system calls writing to the heap
501 (other than read) be handled specially by client code.
502 See os_dep.c for details.
503
504 2. Information supplied by the programmer.  We define "stubborn"
505 objects to be objects that are rarely changed.  Such an object
506 can be allocated (and enabled for writing) with GC_malloc_stubborn.
507 Once it has been initialized, the collector should be informed with
508 a call to GC_end_stubborn_change.  Subsequent writes that store
509 pointers into the object must be preceded by a call to
510 GC_change_stubborn.
511
512 This mechanism performs best for objects that are written only for
513 initialization, and such that only one stubborn object is writable
514 at once.  It is typically not worth using for short-lived
515 objects.  Stubborn objects are treated less efficiently than pointerfree
516 (atomic) objects.
517
518 A rough rule of thumb is that, in the absence of VM information, garbage
519 collection pauses are proportional to the amount of pointerful storage
520 plus the amount of modified "stubborn" storage that is reachable during
521 the collection.
522
523 Initial allocation of stubborn objects takes longer than allocation
524 of other objects, since other data structures need to be maintained.
525
526 We recommend against random use of stubborn objects in client
527 code, since bugs caused by inappropriate writes to stubborn objects
528 are likely to be very infrequently observed and hard to trace.
529 However, their use may be appropriate in a few carefully written
530 library routines that do not make the objects themselves available
531 for writing by client code.
532
533
534 BUGS:
535
536   Any memory that does not have a recognizable pointer to it will be
537 reclaimed.  Exclusive-or'ing forward and backward links in a list
538 doesn't cut it.
539   Some C optimizers may lose the last undisguised pointer to a memory
540 object as a consequence of clever optimizations.  This has almost
541 never been observed in practice.  Send mail to gc@linux.hpl.hp.com
542 for suggestions on how to fix your compiler.
543   This is not a real-time collector.  In the standard configuration,
544 percentage of time required for collection should be constant across
545 heap sizes.  But collection pauses will increase for larger heaps.
546 They will decrease with the number of processors if parallel marking
547 is enabled.
548 (On 2007 vintage machines, GC times may be on the order of 5 msecs
549 per MB of accessible memory that needs to be scanned and processor.
550 Your mileage may vary.)  The incremental/generational collection facility
551 may help in some cases.
552   Please address bug reports to gc@linux.hpl.hp.com.  If you are
553 contemplating a major addition, you might also send mail to ask whether
554 it's already been done (or whether we tried and discarded it).