> On Sep 11, 2023, at 2:09 PM, Martin Bishop via cctalk <cctalk@classiccmp.org>
> wrote:
>
>
>> Did Algol in general have memory leaks?,or is just C and Windows.
>
> This is very much from recollection of programming in Algol 60 & 68, 40+
> years ago.
>
> Algol60 did not have heap storage or pointers IIRC Therefore no potential
> for memory leaks
Correct.
> Algol68R had fairly agressive garbage collection, which generally precluded
> memory leaks, in a language with dynamic arrays, ref ref ref pointers, etc.
I don't know the 68R subset specifically. ALGOL 68 certainly has pointers, and
heap storage, where objects remain in existence so long as something refers to
them. That's similar to the model of BASIC strings, or Python objects.
Garbage collection or reference counting arethe usual way to deal with
unreferenced objects, though things get tricky when circular references are
possible.
> Also, the small memory model of initially 32 kiW address space - which is all
> I can recollect ever using on an unpaged time sharing machine ICL 1904S with
> (IIRC) 256 kiWd of physical memory - leads to a rather more static
> programming style.
>
> The grandchild of the Algols and this style of programming is perhaps subset
> Ada
>
> A wag might observe that programmers may have memory leaks, that teams
> generate memory leaks, and that organisations lack corporate memory.
:-)
The reason C and C++ have memory leaks is that they are low level languages
where there is no linkage between the lifetime of objects and the existence of
references to them, nor in fact a way for the implementation to know whether
there are references. By constrast, in strongly typed languages like ALGOL-68
or Pascal or Ada, and even in languages like Python, that question does have a
clear answer so memory management can be done by the implementation rather than
left to the tender mercies of the programmer.
paul