source: git/ppcc/gclib/htdocs/index.html @ 4bde6b

fieker-DuValspielwiese
Last change on this file since 4bde6b was 4bde6b, checked in by Hans Schoenemann <hannes@…>, 4 years ago
spelling p1
  • Property mode set to 100644
File size: 17.4 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<HTML lang=en-us>
3<HEAD>
4<META http-equiv="content-type" content="text/html; charset=iso-8859-1">
5<META http-equiv="content-language" content="en-us">
6
7<meta name="google-site-verification" content="euF_Ds6ls67K5HQAK1QLmLN-9T0UpvF2SdDOK_qBUIs" />
8<TITLE>TinyGC - Tiny Garbage Collector</TITLE>
9<LINK rev=made href="mailto:ivmai@mail.ru">
10<META name="author" content="Ivan Maidanski">
11
12<STYLE type="text/css"><!--
13
14HTML {
15 font-size: 100%;
16}
17
18BODY {
19 margin: 0.8em;
20 font-family: helvetica, sans-serif;
21 color: black;
22 background: #eff;
23}
24
25H1 {
26 clear: both;
27 margin-top: 0.8em;
28 text-align: center;
29 word-spacing: 0.3em;
30 font-weight: bold;
31 text-decoration: underline;
32}
33
34H3 {
35 clear: both;
36 text-align: left;
37 margin-left: 0.3em;
38 margin-bottom: 0.1em;
39}
40
41P {
42 text-align: justify;
43 text-indent: 1.3em;
44 margin-top: 0.2em;
45 margin-bottom: 0;
46}
47
48OL, UL {
49 text-align: left;
50 text-indent: 1.1em;
51 margin: 0;
52 list-style-position: inside;
53 padding: 0;
54}
55
56ACRONYM {
57 font-weight: bolder;
58 white-space: nowrap;
59}
60
61CODE {
62 font-family: monospace;
63 font-size: 130%;
64}
65
66PRE {
67 padding: 0;
68 margin: 0 0 0.7em 1.3em;
69}
70
71A:link { color: blue; }
72
73A:visited { color: purple; }
74
75A:hover { color: red; }
76
77A:active { color: green; }
78
79A {
80 white-space: nowrap;
81}
82
83A.external { }
84
85A.mailto {
86 color: teal;
87 font-style: oblique;
88}
89
90DIV {
91 min-width: 35em;
92 margin-top: 1em;
93}
94
95DIV.subsection {
96 margin-bottom: 0.9em;
97}
98
99DIV.download {
100 margin-bottom: 0.9em;
101 border-top: 1pt dashed blue;
102}
103
104DIV.license {
105 border-top: thin solid blue;
106 text-align: center;
107 font-size: 110%;
108 font-family: monospace;
109}
110
111DIV.page-footer {
112 border-top: thin solid blue;
113 margin-top: 1.2em;
114 text-align: center;
115}
116
117.copyright {
118 text-align: right;
119 white-space: nowrap;
120 font-size: x-small;
121 font-weight: lighter;
122}
123
124--></STYLE>
125
126</HEAD>
127<BODY>
128
129<A href="http://sourceforge.net/projects/tinygc/">
130<IMG src="http://sflogo.sourceforge.net/sflogo.php?group_id=294566&type=14"
131alt="get TinyGC at SourceForge.net" width=150 height=40 border=0></A>
132
133<H1 align=center>TinyGC</H1>
134
135<DIV class=subsection>
136<H3>Preface</H3>
137<P>TinyGC is an independent implementation of the API of the well-known
138Boehm-Demers-Weiser Conservative GC ("BDWGC" or "BoehmGC" for short).
139<P>TinyGC has been initially developed as a part of the JCGO project to be
140used as a BoehmGC replacement. At present, TinyGC is a standalone project.
141</DIV>
142
143<DIV class=download>
144<H3>Download</H3>
145<P>To get the latest <ACRONYM>TinyGC</ACRONYM> stable release source code,
146please visit
147<A href="http://sourceforge.net/projects/tinygc/files/">"Browse files for
148TinyGC"</A>.
149</DIV>
150
151<DIV class=subsection>
152<H3>Target environments</H3>
153<P><ACRONYM>TinyGC</ACRONYM> is designed to be used primary in projects
154requiring Java-like memory garbage collection functionality for:
155<UL>
156<LI>memory constrained environments;
157<LI>8/16-bit systems;
158<LI>BoehmGC temporal replacement (for application debugging, testing and
159benchmarking purposes);
160<LI>targets where <ACRONYM>BoehmGC</ACRONYM> is still not ported to.
161</UL>
162<P><ACRONYM>TinyGC</ACRONYM> is NOT designed for speed.
163</DIV>
164
165<DIV class=subsection>
166<H3>Design principles</H3>
167<P>The major principles are:
168<UL>
169<LI>source and binary compatibility with <ACRONYM>BoehmGC</ACRONYM>;
170<LI>implements only the minimal subset of the <ACRONYM>BoehmGC</ACRONYM>
171<ACRONYM>API</ACRONYM> (v7.2) sufficient for the
172Java/<ACRONYM>GCJ</ACRONYM>-like functionality;
173<LI>highly portable (contains no assembler, no
174machine/<ACRONYM>OS</ACRONYM>-specific code portions) and tunable;
175<LI>supports 16/32/64-bit architectures ("flat" data models only);
176<LI>compact code and small initial internal data size;
177<LI>simple collection World-stopped Mark-and-Sweep algorithm implementation;
178<LI>malloc-based allocation (i.e. every object is allocated using
179<CODE>malloc()</CODE>);
180<LI>objects finalization and memory recycling (reclaiming to the underlying
181malloc implementation) is done lazily (between collections).
182</UL></DIV>
183
184<DIV class=subsection>
185<H3>Advantages and drawbacks</H3>
186<P>The major <ACRONYM>TinyGC</ACRONYM> advantages over
187<ACRONYM>BoehmGC</ACRONYM> are:
188<UL>
189<LI>small code size (it could be as small as 3800 bytes);
190<LI>16-bit architectures are supported;
191<LI>small initial internal data size;
192<LI>less source code (to verify);
193<LI>minimal set of the underlying
194<ACRONYM>clib</ACRONYM>/<ACRONYM>pthread</ACRONYM>/<ACRONYM>Win32</ACRONYM>
195functions used.
196</UL>
197<P>The drawbacks of <ACRONYM>TinyGC</ACRONYM> are:
198<UL>
199<LI>lower allocation speed and larger world-stopped collection delays
200(typically);
201<LI>only a small subset of the <ACRONYM>BoehmGC</ACRONYM>
202<ACRONYM>API</ACRONYM> is implemented;
203<LI>no support for <ACRONYM>C++</ACRONYM>;
204<LI>no support for architectures with a separate registers stack (like
205<ACRONYM>IA-64</ACRONYM>);
206<LI>no find-leak and pointer back-trace modes;
207<LI>no automatic registration of static data roots, stack bottom and threads;
208<LI>no "advanced" allocation and collection technologies (no blacklisting,
209memory unmapping, thread-local allocation, parallel marking, generation and
210incremental collections);
211<LI>relies on the underlying malloc/free() implementation (which may be
212broken for large heaps, like, e.g., in some versions of msvcrt);
213<LI>"all-interior-pointers" mode is limited by the offset of 256
214<CODE>(1 &lt;&lt; GC_LOG2_OFFIGNORE)</CODE> bytes (this also means that
215disappearing links must not be placed at this or higher offsets of an
216allocated object);
217<LI>only the length-based descriptor for the <ACRONYM>GCJ</ACRONYM>-style
218allocation is supported;
219<LI>only Java-like "no-order" finalization policy is implemented.
220</UL></DIV>
221
222<DIV class=subsection>
223<H3>Notes</H3>
224<P>Release notes:
225<UL>
226<LI>no binary distribution is offered on the official site;
227<LI>no make file (or other building script) is provided.
228</UL>
229<P>Implementation notes:
230<UL>
231<LI>the same environment variables are recognized as in
232<ACRONYM>BoehmGC</ACRONYM>;
233<LI>the finalization and disappearing links implementations are generally the
234same as in <ACRONYM>BoehmGC</ACRONYM>;
235<LI>full <ACRONYM>TinyGC</ACRONYM> implementation resides in a single file
236(all the internal symbols are not visible outside);
237<LI>both <ACRONYM>pthreads</ACRONYM> and <ACRONYM>Win32</ACRONYM> threads are
238supported;
239<LI>no thread-safety of the underlying malloc/free is required;
240<LI>the stack direction is detected at <ACRONYM>TinyGC</ACRONYM>
241initialization;
242<LI>no warnings are printed;
243<LI>the thread "suspend" handler does not use <ACRONYM>pthread</ACRONYM>
244synchronization primitives (yielding and sleeping are used instead for better
245portability);
246<LI><ACRONYM>CPU</ACRONYM> state is saved by <CODE>setjmp()</CODE>;
247<LI>there is no object "header" (i.e. the original object size is passed to
248the underlying <CODE>malloc()</CODE>).
249</UL>
250<P>Usage notes:
251<UL>
252<LI>all pointers must be word-aligned;
253<LI>it is assumed that the compiler performs only <ACRONYM>GC</ACRONYM>-safe
254pointer transformations;
255<LI>static data roots must be manually registered;
256<LI>application threads must be manually registered and unregistered;
257<LI>it would be good to use <CODE>GC_call_with_gc_active()</CODE> to record
258the correct main stack base (after <CODE>GC_INIT()</CODE>).
259</UL></DIV>
260
261<DIV class=subsection>
262<H3>Tuning macros</H3>
263<P>Useful macros for tuning (same as in <ACRONYM>BoehmGC</ACRONYM>):
264<UL>
265<LI>GC_DLL - compile to produce a <ACRONYM>DLL</ACRONYM> (gc.dll);
266<LI>ALL_INTERIOR_POINTERS - turn on "all-interior-pointers" mode by default;
267<LI>GC_GCJ_SUPPORT - compile with <ACRONYM>GCJ</ACRONYM>-style allocation
268support;
269<LI>GC_THREADS - compile with thread support (<ACRONYM>pthread</ACRONYM>-based
270by default);
271<LI>GC_WIN32_THREADS - compile with <ACRONYM>Win32</ACRONYM>-based thread
272support;
273<LI>JAVA_FINALIZATION_NOT_NEEDED - exclude <CODE>GC_finalize_all()</CODE> from
274the <ACRONYM>API</ACRONYM>;
275<LI>DONT_ADD_BYTE_AT_END - do not pad objects even if "all-interior-pointers"
276mode is on;
277<LI>FINALIZE_ON_DEMAND - causes finalizers to be run only in response to
278explicit <CODE>GC_invoke_finalizers()</CODE> calls by default (unless
279overridden at run-time);
280<LI>GC_IGNORE_GCJ_INFO - disable <ACRONYM>GCJ</ACRONYM>-style type information
281(useful for debugging);
282<LI>GC_DONT_EXPAND - do not implicitly expand the heap by default (unless
283overridden at run-time);
284<LI>GC_INITIAL_HEAP_SIZE=&lt;value> - set the desired default initial heap
285size (in bytes);
286<LI>GC_FREE_SPACE_DIVISOR=&lt;value> - the default trade-off between garbage
287collection and heap growth;
288<LI>GC_MAX_RETRIES=&lt;value> - the default maximum number of garbage
289collections attempted before reporting out of memory after a heap expansion
290failure.
291</UL>
292<P>Major <ACRONYM>TinyGC</ACRONYM>-specific macros:
293<UL>
294<LI>GC_PRINT_MSGS - compile with statistic and error printing capabilities;
295<LI>GC_GETENV_SKIP - do not recognize any environment variable (for smaller
296code size or for <ACRONYM>WinCE</ACRONYM> targets);
297<LI>GC_WIN32_WCE - compile for <ACRONYM>WinCE</ACRONYM> (use thread Id instead
298of thread handle, and retry on <CODE>SuspendThread()</CODE> failures);
299<LI>GC_NO_INACTIVE, GC_MISC_EXCLUDE - exclude the corresponding parts of the
300<ACRONYM>TinyGC</ACRONYM> <ACRONYM>API</ACRONYM> (for smaller code size);
301<LI>GC_NO_GCBASE, GC_NO_FNLZ, GC_NO_DLINKS, GC_NO_REGISTER_DLINK - exclude the
302support (i.e. expose dummy support) for the corresponding
303<ACRONYM>TinyGC</ACRONYM> capabilities (for smaller code size);
304<LI>GC_USE_WIN32_SYSTEMTIME - use <ACRONYM>Win32</ACRONYM>
305<CODE>GetSystemTime()</CODE> <ACRONYM>API</ACRONYM> call instead of
306<CODE>ftime()</CODE> or <CODE>gettimeofday()</CODE> ones (useful for
307<ACRONYM>WinCE</ACRONYM>);
308<LI>GC_USE_GETTIMEOFDAY - use Unix <CODE>gettimeofday()</CODE>
309<ACRONYM>API</ACRONYM> call instead of <CODE>ftime()</CODE> one;
310<LI>GC_OMIT_REGISTER_KEYWORD - ignore <ACRONYM>C</ACRONYM> "register" keyword;
311<LI>CONST=/**/ - ignore <ACRONYM>C</ACRONYM> "const" keyword;
312<LI>INLINE=/**/ - ignore <ACRONYM>C</ACRONYM> "__inline" keyword;
313<LI>GC_FASTCALL=/**/ - ignore <ACRONYM>C</ACRONYM>
314<ACRONYM>x86</ACRONYM>-specific "__fastcall" keyword;
315<LI>GC_CLIBDECL=/**/ - ignore <ACRONYM>C</ACRONYM>
316<ACRONYM>x86</ACRONYM>-specific "__cdecl" keyword;
317<LI>GC_DATASTATIC=/**/ - do not use <ACRONYM>C</ACRONYM> static storage class
318for global data;
319<LI>GC_STATIC=/**/ - do not use <ACRONYM>C</ACRONYM> static linkage for
320<ACRONYM>GC</ACRONYM> internal functions;
321<LI>GC_DATASTARTSYM=&lt;id> - specify the external symbol which is the first
322one in the program data section;
323<LI>GC_DATAENDSYM=&lt;id> - specify the external symbol which is the last one
324in the program data section;
325<LI>GC_DATASTARTSYM2=&lt;id> - specify the external symbol which is the first
326one in the program ".bss" section;
327<LI>GC_DATAENDSYM2=&lt;id> - specify the external symbol which is the last one
328in the program ".bss" section;
329<LI>GC_STACKBOTTOMVAR=&lt;id> - specify the external symbol pointing to the
330program main thread stack bottom (or top if GC_STACKLEN is 0);
331<LI>GC_STACKLENVAR=&lt;id> - specify the external symbol pointing to the
332program main thread stack size;
333<LI>GC_SIG_SUSPEND=&lt;sig_id> - use specific signal to suspend Posix threads;
334<LI>GC_WIN32_CONTEXT_SP_NAME=&lt;sp_id> - use specific stack pointer register
335name (defined in <ACRONYM>Win32</ACRONYM> "winnt.h");
336<LI>GC_LOG2_OFFIGNORE=&lt;value> - explicitly specify the number of address
337lowest bits ignored for object address hash computations.
338</UL>
339<P>Useful macros for client application tuning (same as in
340<ACRONYM>BoehmGC</ACRONYM>):
341<UL>
342<LI>GC_DONT_EXPAND - do not implicitly expand the heap (unless overridden at
343run-time);
344<LI>GC_DLL - use <ACRONYM>TinyGC</ACRONYM> residing in a
345<ACRONYM>DLL</ACRONYM>;
346<LI>GC_THREADS - declare the prototypes for the collector multi-threading
347support;
348<LI>GC_CALL=&lt;calling_conv> - explicitly specify calling convention for the
349<ACRONYM>GC</ACRONYM> <ACRONYM>API</ACRONYM> functions;
350<LI>GC_CALLBACK=&lt;calling_conv> - explicitly specify an alternate calling
351convention for the <ACRONYM>GC</ACRONYM> <ACRONYM>API</ACRONYM> user
352callbacks;
353<LI>GC_INITIAL_HEAP_SIZE=&lt;value> - set the desired initial heap size (in
354bytes);
355<LI>GC_MAXIMUM_HEAP_SIZE=&lt;value> - set the desired maximum heap size (in
356bytes);
357<LI>GC_FREE_SPACE_DIVISOR=&lt;value> - set the desired trade-off between
358garbage collection and heap growth;
359<LI>GC_MAX_RETRIES=&lt;value> - set the desired maximum number of garbage
360collections attempted before reporting out of memory after a heap expansion
361failure.
362</UL>
363<P>Note 1: if GC_NO_DLINKS is used without GC_NO_REGISTER_DLINK then all the
364disappearing links are treated as normal pointers.
365<P>Note 2: for Unix use the command-line options:
366<PRE><CODE>
367 -DGC_FASTCALL= -DGC_CLIBDECL=
368</CODE></PRE>
369<P>Note 3: for Solaris <ACRONYM>SunOS</ACRONYM> "cc" use the command-line
370options:
371<PRE><CODE>
372 -DGC_FASTCALL= -DGC_CLIBDECL= -DINLINE=inline -erroff=E_WHITE_SPACE_IN_DIRECTIVE
373</CODE></PRE></DIV>
374
375<DIV class=subsection>
376<H3>Environment variables</H3>
377<P>Environment variables recognized (if supported, same as in
378<ACRONYM>BoehmGC</ACRONYM>):
379<UL>
380<LI>GC_DONT_GC - turn off garbage collection;
381<LI>GC_PRINT_STATS - turn on statistic printing on every garbage collection
382(if supported);
383<LI>GC_ALL_INTERIOR_POINTERS - turn on "all-interior-pointers" collector mode;
384<LI>GC_IGNORE_GCJ_INFO - ignore the <ACRONYM>GCJ</ACRONYM>-style type
385descriptors (if supported);
386<LI>GC_INITIAL_HEAP_SIZE=&lt;value> - set the initial heap size (in bytes);
387<LI>GC_MAXIMUM_HEAP_SIZE=&lt;value> - set the maximum heap size (in bytes);
388<LI>GC_FREE_SPACE_DIVISOR=&lt;value> - change the default trade-off between
389garbage collection and heap growth.
390</UL>
391<P>Note: the values assigned to the specified environment variables override
392the similar default (or the preset at the compilation time) values.
393</DIV>
394
395<DIV class=subsection>
396<H3>Files list</H3>
397<P>The <ACRONYM>TinyGC</ACRONYM> distribution consists of:
398<UL>
399<LI>ChangeLog - the standard changes log file;
400<LI>GNU_GPL.txt - the <ACRONYM>GNU</ACRONYM> <ACRONYM>GPLv2</ACRONYM> license;
401<LI>README.txt - this file;
402<LI>gc.h - the main include file (the subset of that in
403<ACRONYM>BoehmGC</ACRONYM>);
404<LI>gc_gcj.h - <ACRONYM>GCJ</ACRONYM>-style allocation <ACRONYM>API</ACRONYM>
405(the subset of that in <ACRONYM>BoehmGC</ACRONYM>);
406<LI>gc_mark.h - contains only the constants for the
407<ACRONYM>GCJ</ACRONYM>-style length-based descriptors and the collections
408notifier prototypes;
409<LI>javaxfc.h - same as in <ACRONYM>BoehmGC</ACRONYM>;
410<LI>tinygc.c - the <ACRONYM>TinyGC</ACRONYM> implementation itself.
411</UL></DIV>
412
413<DIV class=subsection>
414<H3>User's feedback</H3>
415<P>Any questions, suggestions, bug reports and patches are welcomed at the
416<ACRONYM>TinyGC</ACRONYM>
417<A href="http://sourceforge.net/projects/tinygc/develop/">site tracker</A>
418(hosted at SourceForge.net).
419</DIV>
420
421<DIV class=subsection>
422<H3>External resources</H3>
423<P>Links to the 3rd-party projects:
424<UL>
425<LI><A class=external target="_blank" href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/">BoehmGC</A>
426(A garbage collector for C and C++)
427<LI><A class=external target="_blank" href="http://gcc.gnu.org/java/">GNU GCJ</A>
428(a portable optimizing ahead-of-time compiler for Java)
429</UL>
430<P>For more links, please visit
431"<A href="http://www.ivmaisoft.com/jcgo/links.htm">Java and C/C++ developer web resources</A>"
432hosted on the <ACRONYM>JCGO</ACRONYM> project (a
433<A href="http://www.ivmaisoft.com/jcgo/">java2c/java2exe</A> solution) site.
434</DIV>
435
436<DIV class=license>
437<H3>License</H3>
438<P>This is free software; you can redistribute it and/or modify
439it under the terms of the GNU General Public License as published by
440the Free Software Foundation; either version 2, or (at your option)
441any later version.
442<P>This software is distributed in the hope that it will be useful, but
443WITHOUT ANY WARRANTY; without even the implied warranty of
444MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
445General Public License (GPL) for more details.
446<P>You should have received a copy of the GNU General Public License
447along with this program; if not, write to the Free Software Foundation,
448Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
449<P>Linking this library statically or dynamically with other modules is
450making a combined work based on this library. Thus, the terms and
451conditions of the GNU General Public License cover the whole
452combination.
453<P>As a special exception, the copyright holders of this library give you
454permission to link this library with independent modules to produce an
455executable, regardless of the license terms of these independent
456modules, and to copy and distribute the resulting executable under
457terms of your choice, provided that you also meet, for each linked
458independent module, the terms and conditions of the license of that
459module. An independent module is a module which is not derived from
460or based on this library. If you modify this library, you may extend
461this exception to your version of the library, but you are not
462obligated to do so. If you do not wish to do so, delete this
463exception statement from your version.
464</DIV>
465
466<DIV class=page-footer>
467<P class=copyright>&copy; 2006-2010
468<A class=mailto href="mailto:ivmai@mail.ru">Ivan Maidanski</A>
469</DIV>
470
471<a href="http://www3.clustrmaps.com/counter/maps.php?url=http://tinygc.sourceforge.net" id="clustrMapsLink"><img src="http://www3.clustrmaps.com/counter/index2.php?url=http://tinygc.sourceforge.net" style="border:0px;" alt="Locations of visitors to this page" title="Locations of visitors to this page" id="clustrMapsImg" onerror="this.onerror=null; this.src='http://www2.clustrmaps.com/images/clustrmaps-back-soon.jpg'; document.getElementById('clustrMapsLink').href='http://www2.clustrmaps.com';" />
472</a>
473</BODY></HTML>
Note: See TracBrowser for help on using the repository browser.