|
In computer science, Boehm-Demers-Weiser garbage collector, often simply known as Boehm GC, is a conservative garbage collector for C and C++, which is used by many projects that are implemented in C or C++, as well as by runtime environments for a number of other languages, including the Gnu Compiler for Java runtime environment, and the Mono implementation of the Microsoft .NET platform. It supports numerous operating systems, including many UNIX variants, Microsoft Windows, and Mac OS X, and provides a number of advanced features including incremental collection, parallel collection and a variety of finalizer semantics. Wikibooks Wikiversity has more about this subject: School of Computer Science Open Directory Project: Computer Science Collection of Computer Science Bibliographies Belief that title science in computer science is inappropriate Categories: Computer science | Academic disciplines ...
In computing, garbage collection (also known as GC) is a form of automatic memory management. ...
The C Programming Language, Brian Kernighan and Dennis Ritchie, the original edition that served for many years as an informal specification of the language The C programming language is a standardized programming language developed in the early 1970s by Ken Thompson and Dennis Ritchie for use on the UNIX operating...
C++ (pronounced see plus plus) is a general-purpose computer programming language. ...
The GNU Compiler for Java (GCJ) is a compiler for the Java programming language that is part of the GNU Compiler Collection (GCC). ...
Mono is the name of an open source project led by Novell (formerly by Ximian) to create an ECMA Standard compliant (Ecma-334 and Ecma-335), .NET compatible set of tools, including a C# compiler, a Common Language Runtime and more. ...
Microsoft . ...
In computing, an operating system (OS) is the system software responsible for the direct control and management of hardware and basic system operations. ...
Unix or UNIX is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T Bell Labs employees including Ken Thompson, Dennis Ritchie, and Douglas McIlroy. ...
Microsoft Windows is a range of operating environments for personal computers and servers. ...
Mac OS X is the latest version of the Mac OS, the operating system software for Macintosh computers. ...
In object-oriented programming languages that use automatic garbage collection, a finalizer is a special method that is executed when an object is garbage collected. ...
Example
The code piece below shows how one can use Boehm instead of traditional malloc and free in C [1]. malloc is a function for performing dynamic memory allocation in the C programming language. ...
#include "gc.h" #include <assert.h> #include <stdio.h> int main() { int i; GC_INIT(); /* Optional on Linux/X86; see below. */ for (i = 0; i < 10000000; ++i) { int **p = (int **) GC_MALLOC(sizeof(int *)); int *q = (int *) GC_MALLOC_ATOMIC(sizeof(int)); assert(*p == 0); *p = (int *) GC_REALLOC(q, 2 * sizeof(int)); if (i % 100000 == 0) printf("Heap size = %dn", GC_get_heap_size()); } return 0; } External Links |