[gclist] Boehm gc with STL from gcc 2.95.2?

Boehm, Hans hans_boehm@hp.com
Mon, 17 Apr 2000 10:26:08 -0700


I haven't tried exactly that combination.  But I expect you should be using
new_gc_alloc.h, which is intended for recent versions of the STL.  If that
doesn't work, please let me know, and I'll track it down.  I'll change the
documentation to make that a little less confusing.

-DREDIRECT_MALLOC is not recommended with the standard allocator.  The
problem is that the default SGI allocator uses malloc to allocate large
chunks of memory.  The garbage collector should reclaim those large chunks
when they become completely inaccessible, but it cannot reclaim individual
objects.  This may be enough to eventually bound heap growth, but since the
chunk size grows in geometric progression, that's very unlikely to happen
before you run out of memory and/or address space.

-DREDIRECT_MALLOC should work if you use the malloc_alloc STL allocator,
since that calls malloc directly for each object.

I just made version 5.0alpha6 available.  I'd particularly appreciate bug
reports aginst that version, since I would like to finally turn this into a
real release.

Hans

-----Original Message-----
From: Benjamin Geer [mailto:benjamin.geer@btinternet.com]
Sent: Sunday, April 16, 2000 4:29 PM
To: gclist@iecc.com
Subject: [gclist] Boehm gc with STL from gcc 2.95.2?


I'm resending this message because it doesn't seem to have gone
through the first time.  My apologies if anyone gets it twice.

Has anyone got the Boehm-Demers-Weiser collector working with the
version of the STL that's included in gcc 2.95.2?  I tried the
gc_alloc.h supplied with gc, and got a lot of compiler errors in the
STL header files.  I then tried compiling gc with
-DREDIRECT_MALLOC=GC_malloc and -DIGNORE_FREE, since the default STL
allocator seems to use malloc, but this had no effect as far as I
could tell.  (I included gc_cpp.h, derived a class Foo from
gc_cleanup, and put some pointers to Foos in an STL list; destructors
weren't called on those objects when the list went out of scope, not
even after calling GC_gcollect().)  I'm using gc5.0alpha4 on Linux
i386.

Benjamin Geer
benjamin.geer@btinternet.com