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,
Joe 6 3088
Atip Asvanund wrote: Dear sirs,
FYI, it's conventional to omit greetings and valedictories on usenet.
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.
Is there a newsgroup, mailing list, faq, etc., listed on that site?
Your enquiry is off-topic for comp.lang.c++ - see the welcome message
at http://www.slack.net/~shiva/welcome.txt
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
It is not necessary to list gc.h as a prerequisite of queries, unless
you are going to edit that file.
A correct and idiomatic makefile might go something like this (and if
its filename is Makefile, with a capital 'M', you won't need to specify
the filename when you make).
CXX=g++
CPPFLAGS=-idirafter /new/usr2/xxx/gc/include
CXXFLAGS=-g -o3
LDFLAGS=-L /new/usr2/xxx/lib
LDLIBS=-lgc
all: queries
queries: queries.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
queries.o: queries.cpp queries.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
queries
I don't see what this line was for.
I also include the gc.h file in my source.
This will be "#include <gc.h>" now.
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.
Oh! Well, there must have been a makefile provided with the
distribution, or maybe some instructions for adding a target
called 'c++' to your own makefiles. I don't know, sorry.
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.
By default the standard containers use the std::allocator which uses new
and delete. You may have to provide a custom allocator. (Ouch).
4) In C++ do I include gc.h or do I use a different file?
Some header files are written to be 'bilingual', but not all.
5) Is there a gentler introduction to Boehm with examples that I can use?
Sorry, no idea.
--
Regards,
Buster.
Atip Asvanund wrote: Dear sirs,
FYI, it's conventional to omit greetings and valedictories on usenet.
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.
Is there a newsgroup, mailing list, faq, etc., listed on that site?
Your enquiry is off-topic for comp.lang.c++ - see the welcome message
at http://www.slack.net/~shiva/welcome.txt
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
It is not necessary to list gc.h as a prerequisite of queries, unless
you are going to edit that file.
A correct and idiomatic makefile might go something like this (and if
its filename is Makefile, with a capital 'M', you won't need to specify
the filename when you make).
CXX=g++
CPPFLAGS=-idirafter /new/usr2/xxx/gc/include
CXXFLAGS=-g -o3
LDFLAGS=-L /new/usr2/xxx/lib
LDLIBS=-lgc
all: queries
queries: queries.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
queries.o: queries.cpp queries.h
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $<
queries
I don't see what this line was for.
I also include the gc.h file in my source.
This will be "#include <gc.h>" now.
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.
Oh! Well, there must have been a makefile provided with the
distribution, or maybe some instructions for adding a target
called 'c++' to your own makefiles. I don't know, sorry.
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.
By default the standard containers use the std::allocator which uses new
and delete. You may have to provide a custom allocator. (Ouch).
4) In C++ do I include gc.h or do I use a different file?
Some header files are written to be 'bilingual', but not all.
5) Is there a gentler introduction to Boehm with examples that I can use?
Sorry, no idea.
--
Regards,
Buster.
Atip Asvanund wrote: #define malloc(n) GC_malloc(n) #define calloc(m,n) GC_malloc((m)*( n))
Several possible problems with this.
First, what if malloc and/or calloc is already #defined? You'd better
#undef them first.
Second, unless GC_malloc() zeros out the buffer it returns, you are
changing the semantics of calloc().
Third, you shouldn't use malloc(), calloc() and friends at all in C++
(unless you have a very good reason, which is rare). They don't do
proper initialization and destruction of objects.
-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Atip Asvanund wrote: #define malloc(n) GC_malloc(n) #define calloc(m,n) GC_malloc((m)*( n))
Several possible problems with this.
First, what if malloc and/or calloc is already #defined? You'd better
#undef them first.
Second, unless GC_malloc() zeros out the buffer it returns, you are
changing the semantics of calloc().
Third, you shouldn't use malloc(), calloc() and friends at all in C++
(unless you have a very good reason, which is rare). They don't do
proper initialization and destruction of objects.
-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
I have not used Boehms garbage collector yet.
But I do know that in the March 2003 issue of
C/C++ Users Journal, there was an article
about Boehms garbage collector, and how to use it.
If you are not aware of this, then it might be
profitable for you to read it from local library.
I have not used Boehms garbage collector yet.
But I do know that in the March 2003 issue of
C/C++ Users Journal, there was an article
about Boehms garbage collector, and how to use it.
If you are not aware of this, then it might be
profitable for you to read it from local library. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Atip Asvanund |
last post by:
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
|
by: HalcyonWild |
last post by:
Hi,
I installed the free version(command line only) of the digital mars c++
compiler.
It said it features a garbage collection mechanism, but there was no
documentation. I figured out that you have to extend the class
mentioned in gc.h file. But it does not compile. Does the compiler
automatically extend the gc classes, while compiling.
|
by: Larry Herbinaux |
last post by:
I'm having issues with garbage collection with my long-standing service
process. If you could review and point me in the right direction it would be
of great help. If there are any helpful documents that you could point me to
help me control the GC, then that would be great also.
The .Net GC does not cleanup memory of our service process unless it is
forced to by another process that hogs memory.
· GC Algorithm - This is an issue...
|
by: R. MacDonald |
last post by:
Hello, all,
I am currently working on a .Net (VB) application that invokes routines
in unmanaged (Fortran) DLLs. The unmanaged routines then communicate
with the .Net application by means of a call-back mechanism. These
calls pass a string that contains a "command" and a pointer to a
SafeArray that (depending on the command) either receives data from the
..Net application or provides data to the .Net application.
This mechanism is...
|
by: Mingnan G. |
last post by:
Hello everyone.
I have written a garbage collector for standard C++ application. It has
following main features.
1) Deterministic Finalization
Providing deterministic finalization, the system can manage resources
as well as objects. The programming style is clear and easy, conforming
to RAII (Resource Acquisition Is Initialization) idiom of C++
programmers. The memory usage is very efficient, acyclic garbage is
| |
by: ajayraj |
last post by:
Can anybody say, from where i can get the content related to Boehm's garbage collector.
|
by: xicloid |
last post by:
I'm trying to write a program that saves numbers without any
duplications.
I was thinking I could start by storing the first number in an array
with size one,
and if the next number is not in the array I've created, I save the
first number and the new input number
in a new array with size two and delete the first array from memory.
This goes on until total of twenty numbers are input into the program.
But is it possible to delete...
|
by: malkarouri |
last post by:
Hi everyone,
Is it possible to write a Python extension that uses the Boehm garbage
collector?
I have a C library written that makes use of boehm-gc for memory
management. To use that, I have to call GC_INIT() at the start of the
program that uses the library. Now I want to encapsulate the library
as a CPython extension. The question is really is that possible? And
will there be conflicts between the boehm-gc and Python memory...
|
by: Razii |
last post by:
On Mon, 14 Apr 2008 00:43:31 -0700 (PDT), James Kanze
<james.kanze@gmail.comwrote:
Doesn't look that simple to me. I downloaded gc version 6.7 and 6.8.
nmake nodebug=1 gc.mak
makefile(389) : fatal error U1001: syntax error : illegal character
|
by: monalikolhe |
last post by:
Hey Guys,
I am new to this programming stuff, but i want to try using Hans Boem Garbage Collector (HBGC) as my assignment. I dont know which Compiler to use for it and how to use?
Please Help
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |