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
3
votes
1 answer

Boehm and tagged pointers

Tagged pointers are a common optimization when implementing dynamic languages: take advantage of alignment requirements that mean the low two or three bits of a pointer will always be zero, and use them to store type information. Suppose you're…
rwallace
  • 31,405
  • 40
  • 123
  • 242
3
votes
1 answer

libgc: why this code leaks?

I've tried to use libgc (BDW garbage collector) within this simple code. Note, that reference holded only to last node in a fake "list", so that, living set is only two last nodes. // thanks to @chill for this example #include struct list { …
funny_falcon
  • 427
  • 3
  • 11
3
votes
1 answer

boehm-gc with C++11's thread library

As we know, using boehm-gc in multi-thread requires calling GC_register_my_thread with stack base from GC_get_stack_base. but It seems not to work well with C++11's thread library, such as std::thread... How can I use boehm-gc with C++11's thread…
ikh
  • 10,119
  • 1
  • 31
  • 70
2
votes
5 answers

What does it mean if the garbage collector is "more aggressive" in Monotouch 4?

I stumbled about this question: Button in ContentView causes crash in MonoTouch runtime. Bug in Monotouch 4.0? and the inquirer has problems with Monotouch's "more aggressive" garbage collector. Can somebody explain why in the inquirer's case the…
Krumelur
  • 32,180
  • 27
  • 124
  • 263
2
votes
1 answer

How does one implement weak references with Boehm GC?

I have a personal project which I implement using the Boehm GC. I need to implement a sort of event type, which should hold references to other events. But I also need to ensure that the events pointed to are still collectable, thus I need weak…
Paul Stelian
  • 1,381
  • 9
  • 27
2
votes
1 answer

What are approaches to optimize the mark phase of a non-generational GC?

I am running on Unity's Boehm–Demers–Weiser garbage collector, which is a non-generational GC. I have a large tree of managed objects in memory (~100k objects, ~200MiB allocation). These objects are essentially a cache and never go out of scope, so…
Lazlo
  • 8,518
  • 14
  • 77
  • 116
2
votes
2 answers

garbage collection for `fopen()`?

Boehm gc only deal with memory allocation. But if one wants to use garbage collection to deal with fopen() so that fclose() is no longer needed. Is there a way to do so in C? P.S. For example, PyPy takes the garbage collection approach to deal with…
user1424739
  • 11,937
  • 17
  • 63
  • 152
2
votes
1 answer

Boehm GC: how to effectively debug smashed heap objects?

When running my program I get the following errors from the Boehm GC (with GC_DEBUG defined): GC_check_heap_block: found smashed heap objects: 0x8ef1008 in or near object at 0x8ef1010(, appr. sz = 29) 0x8ef1188 in or near object at…
Max
  • 3,384
  • 2
  • 27
  • 26
2
votes
0 answers

Negative impacts of using GC_malloc_explicitly_typed

I have a substantial C project that has been using the Boehm GC for a while now; it was built from scratch, and it has used the Boehm GC since day one, and its type-allocation behavior is well-known. Currently, it uses GC_MALLOC() and…
Sean Werkema
  • 5,810
  • 2
  • 38
  • 42
2
votes
2 answers

How to use asprintf with the Boehm GC?

As far as I can tell, asprintf calls malloc. If I replace malloc with the Boehm GC, a call to asprintf still calls the traditional malloc - at least that's what valgrind is telling me: Here's the malloc macro: #include #include…
user52804
  • 319
  • 2
  • 5
2
votes
2 answers

How to use Boost.Coroutine with Boehm GC?

Boost.Coroutine allocates its own call stacks. Does Boehm GC consider pointers on these stacks as roots, and if not how can I make it do that? After a context switch to a coroutine, Boehm terminates the program.
user1804599
1
vote
2 answers

BoehmGC - Understanding memory allocator GC_malloc

I am breaking my head in understanding the BoehmGC allocation scheme - GC_malloc. I am not getting how it allocates memory, not seen any malloc or mmap which GC_malloc internally calls. Can someone kindly help me? Any links or code snippet will be…
RajSanpui
  • 11,556
  • 32
  • 79
  • 146
1
vote
0 answers

BoehmGC, wasm malloc and finalizers

I've managed to get BoehmGC working on webassembly by forcing all roots on the "side stack". This is all working fine except for cases where there are lots of finalizers. It all works if I don't have finalizers, no matter how many objects I…
Carlo Kok
  • 1,128
  • 5
  • 14
1
vote
1 answer

Building libgc fails on Mac OS X 10.6 Snow Leopard: ... and require _XOPEN_SOURCE to be defined

The following steps: $ wget http://www.hpl.hp.com/personal/Hans_Boehm/gc/gc_source/gc-7.0.tar.gz $ tar xvfz gc-7.0.tar.gz $ cd gc-7.0 $ ./configure $ make fail with this error: In file included from mach_dep.c:163: /usr/include/ucontext.h:42:2:…
miku
  • 181,842
  • 47
  • 306
  • 310
1
vote
0 answers

How do I keep track of marking work in my own mark procedure for boehm GC and what is the purpose of 'env'

How do I keep track of how much marking work I've done when implementing my own mark procedure? I am working to use the Boehm Weiser Garbage Collector in precise mode. I need to implement my own mark procedures. For large objects like vectors…
drmeister
  • 21
  • 2