www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/23/17:34:06

From: terra AT diku DOT dk (Morten Welinder)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: windows <-> cwsdpmi
Date: 23 Dec 1996 20:27:05 GMT
Organization: Department of Computer Science, U of Copenhagen
Lines: 28
Sender: terra AT tyr DOT diku DOT dk
Message-ID: <59mpup$csp@vidar.diku.dk>
References: <851364688 DOT 618879 DOT 0 AT abwillms DOT demon DOT co DOT uk>
NNTP-Posting-Host: tyr.diku.dk
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

"Alaric B. Williams" <alaric AT abwillms DOT demon DOT co DOT uk> writes:

>Conservative GC can be used in C. It works like so:

You cannot garbage collect in C unless you restrict the class
of valid programs.

Consider:

-----------------------------------------------------------------------------
m = malloc (...);
<fill something into m's data area>
<print m's address to a file, possibly using fprintf's %p>
m = 0;
...
<let garbage collection happen here>
...
<reread m's address>
<access m's data area>
-----------------------------------------------------------------------------

There is no way that the garbage collector could know that m's data
area was pointed to by something in a file.

But all this should not be taken to mean that a garbage collector
used in connection with C can not be useful.  This is just theory.

Morten

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019