[Gc] Beginner's questions

Atip Asvanund atip at andrew.cmu.edu
Tue Apr 6 04:39:09 PDT 2004


Dear sirs,

I am trying to learn how to use Boehm's garbage collector:
http://www.hpl.hp.com/personal/Hans_Boehm/gc/ on a Linux machine. I am a
beginner, and I find its documentation inadequate. I have followed all
instructions for installation, yet I still have the following questions.

1) The instruction said to include the header file, and link to the
library file. I was wondering if I am doing it correctly in my makefile:

-bash-2.05b$ more makefile
queries:        queries.cpp queries.h /new/usr2/xxx/gc/include/gc.h
                g++ -g -o3 queries.cpp /new/usr2/xxx/gc/lib/libgc.a -o
queries

I also include the gc.h file in my source.

2) The instruction said specifically to run "make c++" after a regular
make. I get the following error message, while the regular make and make
install works. I am using c++, so will this cause a problem?

-bash-2.05b$ make c++
make: *** No rule to make target `c++'.  Stop.

3) I am using STL for most of my complex datasets. Does STL work at all
with Boehm? If it does, does it work automatically, or do I need to
specify some special options. What will happen if I use the following
defines:

#define malloc(n) GC_malloc(n)
#define calloc(m,n) GC_malloc((m)*(n))

Other than STL, I use my own codes for the rest of the stuff, so I am not
so worried.

4) In C++ do I include gc.h or do I use a different file?

5) Is there a gentler introduction to Boehm with examples that I can use?

Thank you very much,

Atip


More information about the Gc mailing list