[Gc] Garbage collector bug

Nadel, Alexander ANadel@ndsisrael.com
Wed, 8 Jan 2003 19:23:32 +0200


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
collector.

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. 

Regards,
Nadel Alexander
NDS
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 dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this communication in error, please immediately notify the
postmaster@ndsisrael.com and destroy the original message.