Questions tagged [boehm-gc]

A garbage collecting replacement for C's malloc() using a mark/sweep algorithm.

A tracing (mark/sweep) garbage collector. It periodically determines which objects can be reached by following pointers.

Began life (ca. 1980) as a simple GC for the Russell programming language.

Used among others by:

  • The runtime system for GCJ, the static GNU java compiler.
  • W3m, a text-based web browser.
  • Some versions of the Xerox DocuPrint printer software.
  • The Mozilla project, as leak detector.
  • The Mono project, an open source implementation of the .NET development framework.

Reference:

50 questions
68
votes
2 answers

Is recent GTK 3.22 still Boehm GC friendly (thread issue)?

The Boehm's conservative garbage collector is quite useful (e.g. Bigloo is using it, Guile is using something similar, etc....), notably on Linux (which is the only OS I care about; I'm using Debian/Sid/x86-64 if that matters, and libgc-dev package…
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
39
votes
2 answers

Running Boehm GC in multiple threads independently

I'm experimenting with writing some bindings to the Boehm GC for Rust. Some background: Rust is designed to be a high-concurrent language, and a result of this design is having the ability to statically restrict GC pointers to within the threads in…
huon
  • 94,605
  • 21
  • 231
  • 225
28
votes
3 answers

What's the difference between generational and incremental garbage collection?

I think that both (generational and incremental) are different approaches to make the garbage collection pauses faster. But what are the differences between generational and incremental? How do they work? And which one is better for real time…
Damian
  • 5,471
  • 11
  • 56
  • 89
21
votes
1 answer

How does Boehm GC work for C program?

I checked Boehm GC. The GC for C/C++. I know mark-and-sweep algorithm. What I'm in curious is how it picks up only pointers in whole C memory. My understanding about C memory is just a plain byte array. Is it possible to determine a value in memory…
eonil
  • 83,476
  • 81
  • 317
  • 516
9
votes
1 answer

Custom allocation and Boehm GC

In my on-again-off-again compiler project, I've implemented closures as allocated memory with an executable prefix. So a closure is allocated like this: c = make_closure(code_ptr, env_size, env_data); c is a pointer to a block of allocated memory,…
Edmund
  • 10,533
  • 3
  • 39
  • 57
9
votes
3 answers

Precise mode in Boehm Garbage Collector

I've read on the webpage of Mono that they are using the Boehm GC in precise mode. I too use the Boehm GC with C++, however, I have found nothing in its documentation or headers that would indicate a precise mode, much less how to turn it on. Any…
Frigo
  • 1,709
  • 1
  • 14
  • 32
7
votes
2 answers

Is it possible to use Boehm garbage collector only for the part of the program?

I've read article in LinuxJournal about Boehm-Demers-Weiser garbage collector library. I'm interesting to use it in my library instead of my own reference counting implementation. I have only one question: is it possible to use gc only for my…
bialix
  • 20,053
  • 8
  • 46
  • 63
6
votes
2 answers

Finding roots for garbage collection in C

I'm trying to implement a simple mark and sweep garbage collector in C. The first step of the algorithm is finding the roots. So my question is how can I find the roots in a C program? In the programs using malloc, I'll be using the custom…
questions
  • 2,337
  • 4
  • 24
  • 39
5
votes
1 answer

Binding glib into Crystal lang (GC issue)

I am trying to bind some functions from glib into Crystal. I've done this and it works: @[Link("glib-2.0")] lib LibG fun g_utf8_strup(str : UInt8*, len : UInt32) : UInt8* fun g_utf8_strdown(str : UInt8*, len : UInt32) : UInt8* end However it…
Sergey Potapov
  • 3,819
  • 3
  • 27
  • 46
5
votes
1 answer

Memory leak when using garbage collection with glib

I'm trying to integrate the Boehm garbage collector with GLib in Linux, but in one case I have found that it is not freeing the memory: when I call g_strsplit many times, it will run out of memory and segfault. The README for the garbage collector…
marshallm
  • 1,565
  • 2
  • 11
  • 10
4
votes
1 answer

Any major projects use Boehm GC?

I am curious if any major projects have used Boehm GC? I'm particularly interested in if any gaming projects have used this garbage collector. If not, is Boehm GC bad for gaming projects? I am impressed by the mere fact that simple code such as this…
nobody
  • 61
  • 1
3
votes
1 answer

How do I annotate BoehmGC-collected code for Splint?

Splint does a good job tracking down memory leaks in C code. Every malloc() should have a matching free(). But BoehmGC-collected code uses GC_MALLOC() with no matching GC_FREE(). This makes Splint go crazy with tons of messages about memory leaks…
mcandre
  • 22,868
  • 20
  • 88
  • 147
3
votes
1 answer

C blocks extension (libBlocksRuntime) - use custom memory allocator (Boehm GC) for Block_copy()

I am writing a C program that uses Apple's Blocks extension to provide lexical closures. I am also using the Boehm garbage collector. What I would like is for Block_copy() to use GC_MALLOC when allocating blocks on the heap, so that they are garbage…
3
votes
2 answers

"cord" library that comes with Boehm GC causes undefined reference errors

I have a project that uses Boehm GC, so I thought that I might use the cord string library that comes with it. The problem is that all my calls to the cord functions cause "undefined reference" errors. I do have a file named libcord.so in /usr/lib…
mtk358
  • 565
  • 1
  • 7
  • 20
3
votes
0 answers

Valgrind reports errors with libgc

I'm developing an application with guile and I get some strange errors with it. I suspect that the errors are caused by uninitialized variables in guile or some of the libraries it uses. The problem occurs with both guile versions 2.0 and 2.2. When…
tohoyn
  • 139
  • 4
1
2 3 4