/* The block is completely blacklisted. We need */
/* to drop some such blocks, since otherwise we spend */
- /* all our time traversing them if pointerfree */
+ /* all our time traversing them if pointer-free */
/* blocks are unpopular. */
/* A dropped block will be reconsidered at next GC. */
if ((++count & 3) == 0) {
}
# ifndef GC_DISABLE_INCREMENTAL
/* Notify virtual dirty bit implementation that we are about to */
- /* write. Ensure that pointerfree objects are not protected if */
- /* it's avoidable. This also ensures that newly allocated */
+ /* write. Ensure that pointer-free objects are not protected */
+ /* if it is avoidable. This also ensures that newly allocated */
/* blocks are treated as dirty. Necessary since we don't */
/* protect free blocks. */
GC_ASSERT((size_needed & (HBLKSIZE-1)) == 0);
#ifndef SMALL_CONFIG
/* Variables for world-stop average delay time statistic computation. */
/* "divisor" is incremented every world-stop and halved when reached */
- /* its maximum (or upon "total_time" oveflow). */
+ /* its maximum (or upon "total_time" overflow). */
static unsigned world_stopped_total_time = 0;
static unsigned world_stopped_total_divisor = 0;
# ifndef MAX_TOTAL_TIME_DIVISOR
dnl Features which may be selected in the following thread-detection switch.
AH_TEMPLATE([PARALLEL_MARK], [Define to enable parallel marking.])
AH_TEMPLATE([THREAD_LOCAL_ALLOC],
- [Define to enable thread-local allocation optimisation.])
+ [Define to enable thread-local allocation optimization.])
AH_TEMPLATE([USE_COMPILER_TLS],
[Define to use of compiler-support for thread-local variables.])
/* This greatly increases the probability */
/* of avoiding deadlock if buffer allocation */
/* is redirected to GC_malloc and the */
- /* world is multithreaded. */
+ /* world is multi-threaded. */
char buf[1];
if (fread(buf, 1, 1, f) > 1) {
/* of the heap. */
/* This excludes the check as to whether the back pointer is */
/* odd, which is added by the GC_HAS_DEBUG_INFO macro. */
- /* Note that if DBG_HDRS_ALL is set, uncollectable objects */
+ /* Note that if DBG_HDRS_ALL is set, uncollectible objects */
/* on free lists may not have debug information set. Thus it's */
/* not always safe to return TRUE (1), even if the client does */
/* its part. Return -1 if the object with debug info has been */
seen by the garbage collector. Thus objects pointed to only from such a
region may be prematurely deallocated. It is thus suggested that the
standard "malloc" be used only for memory regions, such as I/O buffers, that
-are guaranteed not to contain pointers to garbage collectable memory.
+are guaranteed not to contain pointers to garbage collectible memory.
Pointers in C language automatic, static, or register variables,
are correctly recognized. (Note that GC_malloc_uncollectable has semantics
similar to standard malloc, but allocates objects that are traced by the
This mechanism performs best for objects that are written only for
initialization, and such that only one stubborn object is writable
at once. It is typically not worth using for short-lived
-objects. Stubborn objects are treated less efficiently than pointerfree
+objects. Stubborn objects are treated less efficiently than pointer-free
(atomic) objects.
A rough rule of thumb is that, in the absence of VM information, garbage
===========================================================================
Kjetil S. Matheussen's notes (28-11-2000)
===========================================================================
-Compiles under SAS/C again. Should allso still compile under other
-amiga compilers without big changes. I haven't checked if it still
-works under gcc, because I don't have gcc for amiga. But I have
+Compiles under SAS/C again. Should also still compile under other
+Amiga compilers without big changes. I haven't checked if it still
+works under gcc, because I don't have gcc for Amiga. But I have
updated 'Makefile', and hope it compiles fine.
The lower part of the new file AmigaOS.c does this in various ways, mainly by
wrapping GC_malloc, GC_malloc_atomic, GC_malloc_uncollectable,
GC_malloc_atomic_uncollectable, GC_malloc_stubborn, GC_malloc_ignore_off_page
- and GC_malloc_atomic_ignore_off_page. GC_realloc is allso wrapped, but
+ and GC_malloc_atomic_ignore_off_page. GC_realloc is also wrapped, but
doesn't do the same effort in preventing to return chip-mem.
Other allocating-functions (f.ex. GC_*_typed_) can probably be
used without any problems, but beware that the warn hook will not be called.
If you absolutely must call abort() instead of exit(), try calling
the GC_amiga_free_all_mem function before abort().
- New amiga-spesific compilation flags:
+ New Amiga-specific compilation flags:
GC_AMIGA_FASTALLOC - By NOT defining this option, GC will work like before,
it will not try to force fast-mem out of the OS, and
no effect if this flag is set.
GC_AMIGA_GC - If gc returns NULL, do a GC_gcollect, and try again. This
- usually is a success with the standard GC configuration.
- It is allso the most important flag to set to prevent
+ usually is a success with the standard GC configuration.
+ It is also the most important flag to set to prevent
GC from returning chip-mem. Beware that it slows down a lot
when a program is rapidly allocating/deallocating when
theres either very little fast-memory left or verly little
GC_AMIGA_ONLYFAST.
If your program demands high response-time, you should
- not define GC_AMIGA_GC, and possible allso define GC_AMIGA_ONLYFAST.
+ not define GC_AMIGA_GC, and possible also define GC_AMIGA_ONLYFAST.
GC_AMIGA_RETRY does not seem to slow down much.
- Allso, when compiling up programs, and GC_AMIGA_FASTALLOC was not defined when
+ Also, when compiling up programs, and GC_AMIGA_FASTALLOC was not defined when
compilling gc, you can define GC_AMIGA_MAKINGLIB to avoid having these allocation-
functions wrapped. (see gc.h)
GC_AMIGA_FASTALLOC by letting the function go thru the new
GC_amiga_allocwrapper_do function-pointer (see gc.h). Means that
sending function-pointers, such as GC_malloc, GC_malloc_atomic, etc.,
- for later to be called like f.ex this, (*GC_malloc_functionpointer)(size),
+ for later to be called like f.ex this, (*GC_malloc_function_pointer)(size),
will not wrap the function. This is normally not a big problem, unless
all allocation function is called like this, which will cause the
atexit un-allocating function never to be called. Then you either
have to manually add the atexit handler, or call the allocation-
functions function-pointer functions like this;
- (*GC_amiga_allocwrapper_do)(size,GC_malloc_functionpointer).
+ (*GC_amiga_allocwrapper_do)(size,GC_malloc_function_pointer).
There are probably better ways this problem could be handled, unfortunately,
I didn't find any without rewriting or replacing a lot of the GC-code, which
I really didn't want to. (Making new GC_malloc_* functions, and just
- define f.ex GC_malloc as GC_amiga_malloc should allso work).
+ define f.ex GC_malloc as GC_amiga_malloc should work too).
- New amiga-spesific function:
+ New Amiga-specific function:
void GC_amiga_set_toany(void (*func)(void));
it will return chip-mem.
-2. A few small compiler-spesific additions to make it compile with SAS/C again.
+2. A few small compiler-specific additions to make it compile with SAS/C again.
3. Updated and rewritten the smakefile, so that it works again and that
- the "unnecesarry" 'SCOPTIONS' files could be removed. Allso included
+ the "unnecessary" 'SCOPTIONS' files could be removed. Also included
the cord-smakefile stuff in the main smakefile, so that the cord smakefile
could be removed too. By writing smake -f Smakefile.smk, both gc.lib and
cord.lib will be made.
Tauchmanns note about that it now works with workbench is definitely wrong
when concerning SAS/C). I guess it works if you use the old "#if 0'ed"-code,
but I haven't tested it. I think the reason for MT to replace the
-"#if 0'ed"-code was only because it was a bit to SAS/C-spesific. But I
+"#if 0'ed"-code was only because it was a bit to SAS/C-specific. But I
don't know. An iconx-script solves this problem anyway.
BEWARE!
-To run gctest, set the stack to around 200000 bytes first.
--SAS/C-spesific: cord will crash if you compile gc.lib with
+-SAS/C-specific: cord will crash if you compile gc.lib with
either parm=reg or parm=both. (missing legal prototypes for
function-pointers someplace is the reason I guess.).
- GC_realloc didn't handle out-of-memory correctly.
- GC_base could return a nonzero value for addresses inside free blocks.
- test.c wasn't really thread safe, and could erroneously report failure
- in a multithreaded environment. (The locking primitives need to be
+ in a multi-threaded environment. (The locking primitives need to be
replaced for other threads packages.)
- GC_CONS was thoroughly broken.
- On a SPARC with dynamic linking, signals stayed diabled while the
- A more refined heap expansion policy. Less space usage by default.
- Various minor enhancements to reduce space usage, and to reduce
the amount of memory scanned by the collector.
-- Uncollectable allocation without per object overhead.
+- Uncollectible allocation without per object overhead.
- More conscientious handling of out-of-memory conditions.
- Fixed a bug in debugging stubborn allocation.
- Fixed a bug that resulted in occasional erroneous reporting of smashed
finalization procedures are called outside of the allocation
lock, making direct use of the interface a little less dangerous.
MAY BREAK EXISTING CLIENTS that assume finalizers
- are protected by a lock. Since there seem to be few multithreaded
+ are protected by a lock. Since there seem to be few multi-threaded
clients that use finalization, this is hopefully not much of
a problem.
- Fixed a gross bug in CORD_prev.
the single-threaded case.
- Reduced retry count in GC_collect_or_expand for garbage
collecting when out of memory.
-- Made uncollectable allocations bypass black-listing, as they
+- Made uncollectible allocations bypass black-listing, as they
should.
- Fixed a bug in typed_test in test.c that could cause (legitimate)
GC crashes.
DEC Alpha. (Thanks to Matthew Flatt.)
- Added base pointer checking to GC_REGISTER_FINALIZER in debugging
mode, at the suggestion of Jeremy Fitzhardinge.
- - GC_debug_realloc failed for uncollectable objects. (Thanks to
+ - GC_debug_realloc failed for uncollectible objects. (Thanks to
Jeremy Fitzhardinge.)
- Explicitly typed allocation could crash if it ran out of memory.
(Thanks to Jeremy Fitzhardinge.)
- Added the beginning of Irix pthread support.
- Integrated Xiaokun Zhu's fixes for djgpp 2.01.
- Added SGI-style STL allocator support (gc_alloc.h).
- - Fixed a serious bug in README.solaris2. Multithreaded programs must include
+ - Fixed a serious bug in README.solaris2. Multi-threaded programs must include
gc.h with SOLARIS_THREADS defined.
- - Changed GC_free so it actually deallocates uncollectable objects.
+ - Changed GC_free so it actually deallocates uncollectible objects.
(Thanks to Peter Chubb for pointing out the problem.)
- Added Linux ELF support for dynamic libararies. (Thanks again to
Patrick Bridges.)
- Fixed a syntactic error in the DJGPP code. (Thanks to Fergus
Henderson for finding this by inspection.) Also fixed a test program
problem with DJGPP (Thanks to Peter Monks.)
- - Atomic uncollectable objects were not treated correctly by the
+ - Atomic uncollectible objects were not treated correctly by the
incremental collector. This resulted in weird log statistics and
occasional performance problems. (Thanks to Peter Chubb for pointing
this out.)
- Fixed several problems with thread local allocation of pointerfree or
typed objects. The collector was reclaiming thread-local free lists, since
it wasn't following the link fields.
- - There was apparently a long-standing race condition related to multithreaded
+ - There was apparently a long-standing race condition related to multi-threaded
incremental collection. A collection could be started and a thread stopped
between the memory unprotect system call and the setting of the
corresponding dirt bit. I believe this did not affect Solaris or PCR, which
Since 6.0alpha9:
- Two more bug fixes for KEEP_BACK_PTRS and DBG_HDRS_ALL.
- Fixed a stack clearing problem that resulted in SIGILL with a
- misaligned stack pointer for multithreaded SPARC builds.
+ misaligned stack pointer for multi-threaded SPARC builds.
- Integrated another HURD patch (thanks to Igor Khavkine).
Since 6.0:
implementation should be easier to add.
Since 6.1alpha1:
- - No longer wrap read by default in multithreaded applications. It was
+ - No longer wrap read by default in multi-threaded applications. It was
pointed out on the libgcj list that this holds the allocation lock for
way too long if the read blocks. For now, reads into the heap are
broken with incremental collection. It's possible to turn this back on
dllimport/export defines in gc.h. (Thanks to Adam Megacz.)
- GC_malloc_many didn't set hb_last_reclaimed when it called
GC_reclaim_generic. (I'm not sure this matters much, but ...)
- - Allocating uncollectable objects with debug information sometimes
- allocated objects that were one byte too small, since uncollectable
+ - Allocating uncollectible objects with debug information sometimes
+ allocated objects that were one byte too small, since uncollectible
objects don't have the extra byte added at the end. (Thanks to
Wink Saville for pointing this out.)
- Added a bit more assertion checking to make sure that gcj objects
- Some more patches for Linux on HP PA-RISC.
- Added include/gc_allocator.h. It implements (hopefully) standard
conforming (as opposed to SGI-style) allocators that allocate
- collectable (gc_allocator) or GC-traceable, but not collectable
+ collectible (gc_allocator) or GC-traceable, but not collectible
(traceable_allocator) objects. This borrows heavily from libstc++,
which borrows heavily from the SGI implementation, this part of
which was written by Matt Austern. Changed test_cpp.cc to very
- Attempted to sanitize the various DLL macros. GC_USE_DLL disappeared.
GC_DLL is used instead. All internal tests are now on GC_DLL.
README.macros is now more precise about the intended meaning.
- - Include DllMain in the multithreaded win32 version only if the
+ - Include DllMain in the multi-threaded win32 version only if the
collector is actually built as a dll. (Thanks to Mohan Embar for
a version of the patch.)
- Hide the cygwin threadAttach/Detach functions. They were violating our
win32_threads.c for those two cases.
- Got rid of the FASTLOCK() machinery. It doesn't seem useful on modern
platforms.
- - Cleaned up the uncollectable allocation routines, speeding up the
+ - Cleaned up the uncollectible allocation routines, speeding up the
slower paths. The code did enough unnecessary work off the critical path
that the underlying logic was getting hard to extract.
- No longer turn off THREAD_LOCAL_ALLOC with DBG_HDRS_ALL. Indications
Software Practice and Experience 25, 12, December 1995, pp. 1315-1330.
A fundamentally similar "rope" data structure is also part of SGI's standard
-template library implementation, and its descendents, which include the
+template library implementation, and its descendants, which include the
GNU C++ library. That uses reference counting by default.
There is a short description of that data structure at
http://reality.sgi.com/boehm/ropeimpl.html . (The more official location
http://www.sgi.com/tech/stl/ropeimpl.html is missing a figure.)
-All of these are descendents of the "ropes" in Xerox Cedar.
+All of these are descendants of the "ropes" in Xerox Cedar.
de.c is a very dumb text editor that illustrates the use of cords.
It maintains a list of file versions. Each version is simply a
(Its 3 line "user manual" can be obtained by invoking it without
arguments. Note that ^R^N and ^R^P move the cursor by
almost a screen. It does not understand tabs, which will show
-up as highlighred "I"s. Use the UNIX "expand" program first.)
+up as highlighted "I"s. Use the UNIX "expand" program first.)
To build the editor, type "make cord/de" in the gc directory.
This package assumes an ANSI C compiler such as gcc. It will
Dynamic loading support requires that executables be linked with -ldld.
The alternative is to build the collector without defining DYNAMIC_LOADING
-in gcconfig.h and ensuring that all garbage collectable objects are
+in gcconfig.h and ensuring that all garbage collectible objects are
accessible without considering statically allocated variables in dynamic
libraries.
See README.alpha for Linux on DEC AXP info.
-This file applies mostly to Linux/Intel IA32. Ports to Linux on an M68K, IA64,
-SPARC, MIPS, Alpha and PowerPC are also integrated. They should behave
+This file applies mostly to Linux/Intel IA32. Ports to Linux on an M68K,
+IA64, SPARC, MIPS, Alpha and PowerPC are integrated too. They should behave
similarly, except that the PowerPC port lacks incremental GC support, and
it is unknown to what extent the Linux threads code is functional.
See below for M68K specific notes.
6) Thread local storage may not be viewed as part of the root set by the
collector. This probably depends on the linuxthreads version. For the
- time being, any collectable memory referenced by thread local storage should
- also be referenced from elsewhere, or be allocated as uncollectable.
+ time being, any collectible memory referenced by thread local storage
+ should also be referenced from elsewhere, or be allocated as uncollectible.
(This is really a bug that should be fixed somehow. The current GC
version probably gets things right if there are not too many tls locations
and if dlopen is not used.)
SIGSEGV is encountered (or when the collector aborts for some other reason),
and a debugger can then be attached to the looping
process. This sidesteps common operating system problems related
-to incomplete core files for multithreaded applications, etc.
+to incomplete core files for multi-threaded applications, etc.
<H2>Other Signals</h2>
-On most platforms, the multithreaded version of the collector needs one or
+On most platforms, the multi-threaded version of the collector needs one or
two other signals for internal use by the collector in stopping threads.
It is normally wise to tell the debugger to ignore these. On Linux,
the collector currently uses SIGPWR and SIGXCPU by default.
performance, perhaps drastically so if the application is paging.
<LI> If you allocate large objects containing only
one or two pointers at the beginning, either try the typed allocation
-primitives is <TT>gc_typed.h</tt>, or separate out the pointerfree component.
+primitives is <TT>gc_typed.h</tt>, or separate out the pointer-free component.
<LI> Consider using <TT>GC_malloc_ignore_off_page()</tt>
to allocate large objects. (See <TT>gc.h</tt> and above for details.
Large means > 100K in most environments.)
it may happen for reasons like the following:
<OL>
<LI> The collector did not intercept the creation of threads correctly in
-a multithreaded application, <I>e.g.</i> because the client called
+a multi-threaded application, <I>e.g.</i> because the client called
<TT>pthread_create</tt> without including <TT>gc.h</tt>, which redefines it.
<LI> The last pointer to an object in the garbage collected heap was stored
somewhere were the collector couldn't see it, <I>e.g.</i> in an
of the garbage collector. Certain kinds are scanned for pointers,
others are not. Some may have per-object type descriptors that
determine pointer locations. Or a specific kind may correspond
-to one specific object layout. Two built-in kinds are uncollectable.
+to one specific object layout. Two built-in kinds are uncollectible.
One (<TT>STUBBORN</tt>) is immutable without special precautions.
In spite of that, it is very likely that most C clients of the
collector currently
objects. In this case <TT>GC_objects_are_marked</tt> will simultaneously
be false, so the mark state is advanced to
<LI> <TT>MS_PUSH_UNCOLLECTABLE</tt> indicating that it suffices to push
-uncollectable objects, roots, and then mark everything reachable from them.
-<TT>Scan_ptr</tt> is advanced through the heap until all uncollectable
+uncollectible objects, roots, and then mark everything reachable from them.
+<TT>Scan_ptr</tt> is advanced through the heap until all uncollectible
objects are pushed, and objects reachable from them are marked.
At that point, the next call to <TT>GC_mark_some</tt> calls
<TT>GC_push_roots</tt> to push the roots. It the advances the
to a currently unallocated page inside the heap. Pages that have been
the targets of such near misses are likely to be the targets of
misidentified ``pointers'' in the future. To minimize the future
-damage caused by such misidentifications they will be allocated only to
-small pointerfree objects.
+damage caused by such misidentification, they will be allocated only to
+small pointer-free objects.
<P>
The collector understands two different kinds of black-listing. A
page may be black listed for interior pointer references
drops (i.e. allocates and forgets) blocks that are completely black-listed
in order to avoid excessively long large block free lists containing
only unusable blocks. This would otherwise become an issue
-if there is low demand for small pointerfree objects.
+if there is low demand for small pointer-free objects.
<H2>Thread support</h2>
We support several different threading models. Unfortunately Pthreads,
<P>
Clients should include <TT>gc.h</tt>.
<P>
-In the case of multithreaded code,
+In the case of multi-threaded code,
<TT>gc.h</tt> should be included after the threads header file, and
after defining the appropriate <TT>GC_</tt><I>XXXX</i><TT>_THREADS</tt> macro.
(For 6.2alpha4 and later, simply defining <TT>GC_THREADS</tt> should suffice.)
Identical to <TT>GC_MALLOC</tt>,
except that the resulting object is not automatically
deallocated. Unlike the system-provided malloc, the collector does
-scan the object for pointers to garbage-collectable memory, even if the
+scan the object for pointers to garbage-collectible memory, even if the
block itself does not appear to be reachable. (Objects allocated in this way
are effectively treated as roots by the collector.)
<DT> <B> void * GC_REALLOC(void *<I>old</i>, size_t <I>new_size</i>) </b>
convenient. If the original object was allocated with
<TT>GC_MALLOC_ATOMIC</tt>,
the new object is subject to the same constraints. If it was allocated
-as an uncollectable object, then the new object is uncollectable, and
+as an uncollectible object, then the new object is uncollectible, and
the old object (if different) is deallocated.
<DT> <B> void GC_FREE(void *<I>dead</i>) </b>
<DD>
Explicitly deallocate an object. Typically not useful for small
-collectable objects.
+collectible objects.
<DT> <B> void * GC_MALLOC_IGNORE_OFF_PAGE(size_t <I>nbytes</i>) </b>
<DD>
<DT> <B> void * GC_MALLOC_ATOMIC_IGNORE_OFF_PAGE(size_t <I>nbytes</i>) </b>
operator, default malloc, and default STL allocators allocate memory
that is not garbage collected, and is not normally "traced" by the
collector. This means that any pointers in memory allocated by these
-default allocators will not be seen by the collector. Garbage-collectable
+default allocators will not be seen by the collector. Garbage-collectible
memory referenced only by pointers stored in such default-allocated
objects is likely to be reclaimed prematurely by the collector.
<P>
-It is the programmers responsibility to ensure that garbage-collectable
+It is the programmers responsibility to ensure that garbage-collectible
memory is referenced by pointers stored in one of
<UL>
<LI> Program variables
<LI> Uncollected but "traceable" objects
</ul>
"Traceable" objects are not necessarily reclaimed by the collector,
-but are scanned for pointers to collectable objects.
+but are scanned for pointers to collectible objects.
They are usually allocated by <TT>GC_MALLOC_UNCOLLECTABLE</tt>, as described
above, and through some interfaces described below.
<P>
point to otherwise reachable memory. This is another bug whose
proper repair requires platform hooks.)
<P>
-The easiest way to ensure that collectable objects are properly referenced
-is to allocate only collectable objects. This requires that every
+The easiest way to ensure that collectible objects are properly referenced
+is to allocate only collectible objects. This requires that every
allocation go through one of the following interfaces, each one of
which replaces a standard C++ allocation mechanism. Note that
this requires that all STL containers be explicitly instantiated with
<LI> <TT>gc_allocator</tt>
</ul>
which may be used either directly to allocate memory or to instantiate
-container templates.
-The former allocates uncollectable but traced memory.
+container templates.
+The former allocates uncollectible but traced memory.
The latter allocates garbage-collected memory.
<P>
These should work with any fully standard-conforming C++ compiler.
<LI> <TT>gc_alloc</tt>
<LI> <TT>single_client_gc_alloc</tt>
</ul>
-The first two allocate uncollectable but traced
-memory, while the second two allocate collectable memory.
+The first two allocate uncollectible but traced
+memory, while the second two allocate collectible memory.
The <TT>single_client</tt> versions are not safe for concurrent access by
multiple threads, but are faster.
<P>
<DT> <B> Class inheritance based interface for new-based allocation</b>
<DD>
Users may include gc_cpp.h and then cause members of classes to
-be allocated in garbage collectable memory by having those classes
+be allocated in garbage collectible memory by having those classes
inherit from class gc.
For details see <A HREF="http://hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc_cpph.txt">gc_cpp.h</a>.
<P>
Linking against libgccpp in addition to the gc library overrides
-::new (and friends) to allocate traceable memory but uncollectable
-memory, making it safe to refer to collectable objects from the resulting
+::new (and friends) to allocate traceable memory but uncollectible
+memory, making it safe to refer to collectible objects from the resulting
memory.
<DT> <B> C interface </b>
<DD>
<OL>
<LI> <I>Ensure that a.out is a single-threaded executable, or you are using
a very recent (7.0alpha7+) collector version on Linux.</i>
-On most platforms this does not
-work at all for multithreaded programs.
+On most platforms this does not work at all for the multi-threaded programs.
<LI> If possible, ensure that the <TT>addr2line</tt> program is installed in
<TT>/usr/bin</tt>. (It comes with most Linux distributions.)
<LI> If possible, compile your program, which we'll call <TT>a.out</tt>,
<a href="ftp://ftp.cs.colorado.edu/pub/techreports/zorn/CU-CS-665-93.ps.Z">Memory Allocation Costs in Large C and C++ Programs</a>.)
For programs allocating primarily very small objects, the collector
may be faster; for programs allocating primarily large objects it will
-be slower. If the collector is used in a multithreaded environment
+be slower. If the collector is used in a multi-threaded environment
and configured for thread-local allocation, it may in some cases
significantly outperform malloc/free allocation in time.
</p><p>
<H3><FONT COLOR=green>Threads</font></h3>
<FONT COLOR=green>
-For a multithreaded program some more rules apply:
+For a multi-threaded program, some more rules apply:
</font>
<UL>
<LI>
This implementation module for gc_c++.h provides an implementation of
the global operators "new" and "delete" that calls the Boehm
allocator. All objects allocated by this implementation will be
-non-collectable but part of the root set of the collector.
+uncollectible but part of the root set of the collector.
You should ensure (using implementation-dependent techniques) that the
linker finds this module before the library that defines the default
/* The latter alternative can be used if each */
/* object contains a type descriptor in the */
/* first word. */
- /* Note that in multithreaded environments */
- /* per object descriptors must be located in */
+ /* Note that in the multi-threaded environments */
+ /* per-object descriptors must be located in */
/* either the first two or last two words of */
/* the object, since only those are guaranteed */
/* to be cleared while the allocation lock is */
GC_API unsigned GC_CALL GC_new_proc(GC_mark_proc);
GC_API unsigned GC_CALL GC_new_proc_inner(GC_mark_proc);
-/* Allocate an object of a given kind. Note that in multithreaded */
+/* Allocate an object of a given kind. Note that in the multi-threaded */
/* contexts, this is usually unsafe for kinds that have the descriptor */
/* in the object itself, since there is otherwise a window in which */
/* the descriptor is not correct. Even in the single-threaded case, */
/* that we can locate thread stacks and stop the world. */
/* Note also that the collector cannot always see thread specific data. */
/* Thread specific data should generally consist of pointers to */
-/* uncollectable objects (allocated with GC_malloc_uncollectable, */
+/* uncollectible objects (allocated with GC_malloc_uncollectable, */
/* not the system malloc), which are deallocated using the destructor */
/* facility in thr_keycreate. Alternatively, keep a redundant pointer */
/* to thread specific data on the thread stack. */
// real one must be updated with a procedure call.
static size_t GC_bytes_recently_allocd;
- // Same for uncollectable memory. Not yet reflected in either
+ // Same for uncollectible memory. Not yet reflected in either
// GC_bytes_recently_allocd or GC_non_gc_bytes.
static size_t GC_uncollectable_bytes_recently_allocd;
// Similar counter for explicitly deallocated memory.
static size_t GC_bytes_recently_freed;
- // Again for uncollectable memory.
+ // Again for uncollectible memory.
static size_t GC_uncollectable_bytes_recently_freed;
static void * GC_out_of_line_malloc(size_t nwords, int kind);
typedef single_client_gc_alloc_template<0> single_client_gc_alloc;
-// Once more, for uncollectable objects.
+// Once more, for uncollectible objects.
template <int dummy>
class single_client_traceable_alloc_template {
public:
#else
/* Add space for END_FLAG, but use any extra space that was already */
/* added to catch off-the-end pointers. */
- /* For uncollectable objects, the extra byte is not added. */
+ /* For uncollectible objects, the extra byte is not added. */
# define UNCOLLECTABLE_DEBUG_BYTES (sizeof (oh) + sizeof (word))
# define DEBUG_BYTES (UNCOLLECTABLE_DEBUG_BYTES - EXTRA_BYTES)
#endif
/* grungy objects above scan_ptr. */
#define MS_PUSH_UNCOLLECTABLE 2 /* I holds, except that marked */
- /* uncollectable objects above scan_ptr */
+ /* uncollectible objects above scan_ptr */
/* may point to unmarked objects. */
/* Roots may point to unmarked objects */
/* free list for atomic objs */
# endif
void *_uobjfreelist[MAXOBJGRANULES+1];
- /* Uncollectable but traced objs */
+ /* Uncollectible but traced objs */
/* objects on this and auobjfreelist */
/* are always marked, except during */
/* garbage collections. */
# ifdef ATOMIC_UNCOLLECTABLE
# define GC_auobjfreelist GC_arrays._auobjfreelist
void *_auobjfreelist[MAXOBJGRANULES+1];
- /* Atomic uncollectable but traced objs */
+ /* Atomic uncollectible but traced objs */
# endif
word _composite_in_use; /* Number of bytes in the accessible */
/* composite objects. */
struct callinfo _last_stack[NFRAMES];
/* Stack at last garbage collection. Useful for */
/* debugging mysterious object disappearances. In the */
- /* multithreaded case, we currently only save the */
+ /* multi-threaded case, we currently only save the */
/* calling stack. */
# endif
};
return ((ptr_t)p);
}
-/*
- * Allocate a new heapblock for small objects of size gran granules.
- * Add all of the heapblock's objects to the free list for objects
- * of that size.
- * Set all mark bits if objects are uncollectable.
- * Will fail to do anything if we are out of memory.
- */
+/* Allocate a new heapblock for small objects of size gran granules. */
+/* Add all of the heapblock's objects to the free list for objects */
+/* of that size. Set all mark bits if objects are uncollectible. */
+/* Will fail to do anything if we are out of memory. */
GC_INNER void GC_new_hblk(size_t gran, int kind)
{
- struct hblk *h; /* the new heap block */
+ struct hblk *h; /* the new heap block */
GC_bool clear = GC_obj_kinds[kind].ok_init;
GC_STATIC_ASSERT((sizeof (struct hblk)) == HBLKSIZE);
/* This still serves as sample code if you do want to wrap system calls.*/
#if !defined(MSWIN32) && !defined(MSWINCE) && !defined(GC_USE_LD_WRAP)
-/* Replacement for UNIX system call. */
-/* Other calls that write to the heap should be handled similarly. */
-/* Note that this doesn't work well for blocking reads: It will hold */
-/* the allocation lock for the entire duration of the call. Multithreaded */
-/* clients should really ensure that it won't block, either by setting */
-/* the descriptor nonblocking, or by calling select or poll first, to */
-/* make sure that input is available. */
-/* Another, preferred alternative is to ensure that system calls never */
-/* write to the protected heap (see above). */
+/* Replacement for UNIX system call. */
+/* Other calls that write to the heap should be handled similarly. */
+/* Note that this doesn't work well for blocking reads: It will hold */
+/* the allocation lock for the entire duration of the call. */
+/* Multi-threaded clients should really ensure that it won't block, */
+/* either by setting the descriptor non-blocking, or by calling select */
+/* or poll first, to make sure that input is available. */
+/* Another, preferred alternative is to ensure that system calls never */
+/* write to the protected heap (see above). */
# include <unistd.h>
# include <sys/uio.h>
ssize_t read(int fd, void *buf, size_t nbyte)
/* in hard cases. (This is intended for debugging use with */
/* untyped allocations. The idea is that it should be possible, though */
/* slow, to add such a call to all indirect pointer stores.) */
-/* Currently useless for multithreaded worlds. */
+/* Currently useless for the multi-threaded worlds. */
GC_API void * GC_CALL GC_is_visible(void *p)
{
hdr *hhdr;