Regarding Re: GC & GPC question.; "Khimenko Victor" gpc@khim.sch57.msk.ru adds:
KV> 7-Mar-00 18:57 you wrote:
One of the things that steers me away from Borland Pascal is its lack of a runtime garbage collector.
Does GNU Pascal have a runtime garbage collector?
KV> No. To All: perhaps something can be done here ? Boehm's GC will work just fine KV> with GPC in simple cases but if you'll try to use strings or some other complex KV> structures it'll be less great :-/ In C++ it's done with "class's new" but I KV> know of no such mechanism in GPC ... At least low-level allocation functions KV> needed (now many bytes GC should allocate to put this structure there? how KV> really put it there?)... AFAIK something was done for shared-memory access KV> and can be used for GC as well but I'm not remember details (is it documented KV> somewhere?)...
As it is defined, Pascal does not need a garbage collector, but only a memory handler: new() asks the memory handler to allocate a memory block, dispose() tells the memory handler that a memory block is no longer used.
With a true GC, dispose() would not exist, and one should be able to trace all dynamic blocks still in use in order to collect the remainder. Nothing in the definition of Pascal is done for allowing such a behavior.
Olivier Lecarme