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?
Sincerely, ==Joe Blask==
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?
No. To All: perhaps something can be done here ? Boehm's GC will work just fine with GPC in simple cases but if you'll try to use strings or some other complex structures it'll be less great :-/ In C++ it's done with "class's new" but I know of no such mechanism in GPC ... At least low-level allocation functions needed (now many bytes GC should allocate to put this structure there? how really put it there?)... AFAIK something was done for shared-memory access and can be used for GC as well but I'm not remember details (is it documented somewhere?)...
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
Hello!
Does GNU Pascal have a runtime garbage collector?
No. To All: perhaps something can be done here ?
Yes. It is straightforward to use GCC's "obstacks" from GPC. Someone would just have to write a portable Unit to use them. It could even hook into GPC's `New' routine.
Someone?
Peter
8-Mar-00 13:44 you wrote:
Hello!
Does GNU Pascal have a runtime garbage collector?
No. To All: perhaps something can be done here ?
Yes. It is straightforward to use GCC's "obstacks" from GPC. Someone would just have to write a portable Unit to use them. It could even hook into GPC's `New' routine.
Huh. May be I misundestood something but how obstacks will help create something akin to attached C++ example ?
Someone?
So far I can not understood how to have both NonGC-capable new and GC-capable new in one program in the same time (switching is not an option: think about threads!).
P.S. Sample will work this way: -- cut -- [khim@localhost khim]$ ./test OldNormalNonGcClass created TestClass created OldNormalNonGcClass destroyed TestClass destroyed [khim@localhost khim]$ -- cut -- If you'll remove explicit delete call then OldNormalNonGcClass will not be destroyed, of course but if you'll make it GC-capable it'll be destroyed without explicit delete. Mix of GC-objects and non-GC objects is inevitable in real world :-(
Khimenko Victor wrote:
[...] It is straightforward to use GCC's "obstacks" from GPC. Someone would just have to write a portable Unit to use them. It could even hook into GPC's `New' routine.
Huh. May be I misundestood something but how obstacks will help create something akin to attached C++ example ?
No, you were right; I have misunderstood obstacks. They are used inside GCC about like (UCSD) Pascal's `mark'/`release' feature.
Sorry for the confusion,
Peter
Oops. As usual: "attached program is mentioned" nothing is attached :-/ Here it is.
8-Mar-00 13:44 you wrote:
Hello!
Does GNU Pascal have a runtime garbage collector?
No. To All: perhaps something can be done here ?
Yes. It is straightforward to use GCC's "obstacks" from GPC. Someone would just have to write a portable Unit to use them. It could even hook into GPC's `New' routine.
Huh. May be I misundestood something but how obstacks will help create something akin to attached C++ example ?
Someone?
So far I can not understood how to have both NonGC-capable new and GC-capable new in one program in the same time (switching is not an option: think about threads!).
P.S. Sample will work this way: -- cut -- [khim@localhost khim]$ ./test OldNormalNonGcClass created TestClass created OldNormalNonGcClass destroyed TestClass destroyed [khim@localhost khim]$ -- cut -- If you'll remove explicit delete call then OldNormalNonGcClass will not be destroyed, of course but if you'll make it GC-capable it'll be destroyed without explicit delete. Mix of GC-objects and non-GC objects is inevitable in real world :-(