[Gc] RE: Garbage collector bug
Wed, 8 Jan 2003 09:42:55 -0800
Is this really using our garbage collector?
Gcc uses garbage collectors in three very different ways:
1) The compiler itself has its own internal garbage collector. If this fails, the most likely symptom is a compiler crash. It is also conceivable that gcc may generate incorrect code. This garbage collector is not part of the generated executable. It only handles the compilers internal tree representation of the program. I don't think this collector is relevant here, and it's not the subject of this mailing list.
2) It uses a variant of our collector in the Java (gcj) run-time. But we're dealing with a C program here.
3) I believe there is a way to have Objective C programs use our collector, but I'm not very familiar with the details. Last I heard, this required you to install a separate copy of the collector, not the one in the gcc tree.
It's certainly possible to use our collector with a C program, but you have to do so quite explicitly. If this is what's being done, then it would be useful if you could reduce the problem to a small test case. Alternatively, there are hints for debugging this sort of problem near the end of
> -----Original Message-----
> From: Nadel, Alexander [mailto:ANadel@ndsisrael.com]
> Sent: Wednesday, January 08, 2003 9:24 AM
> To: 'Hans_Boehm@hp.com'
> Cc: 'firstname.lastname@example.org'
> Subject: Garbage collector bug
> I have written a program in ANSI C that is supposed to work under any
> platform and for any C compiler. After checking that it does
> work under
> Windows and various UNIX system, I released it. Than I got a
> report that it
> doesn't work properly when compiled using gcc, which uses
> built-in garbage
> After some investigation, I understood that there happened
> the following
> problem :
> At some stage of program's running there where 2 memory
> blocks A and B, A
> holding pointers to B.
> Than A was reallocated : A = realloc(A,...).
> A was copied to another location holding the same data and
> the same pointers
> to B.
> But, the data in B have changed! It shouldn't have happened
> and it doesn't
> happen with other compilers.
> I suspect, that the garbage collector thinks that nobody
> points to B while A
> is being reallocated and frees B.
> Nadel Alexander
> phone : 02-5894632
> fax : 02-5894825
> Information contained in this email message is intended only
> for use of the
> individual or entity named above. If the reader of this
> message is not the
> intended recipient, or the employee or agent responsible to
> deliver it to
> the intended recipient, you are hereby notified that any
> distribution or copying of this communication is strictly
> prohibited. If you
> have received this communication in error, please immediately
> notify the
> email@example.com and destroy the original message.