On Thu, 2024-12-12 at 05:17 +0800, Bret Busby wrote: > > I call this "memory leakage". I don't know if actual code bugs, or > > the > > sloppy way Firefox allocates and frees memory. As far as I know, > > all > > browsers suffer from this. If you find one which doesn't, let us > > know. > > > > Paul > > > > Many years ago, I believe when I was being taught 'C' programming, we > were taught to use two instructions named malloc and (I believe the > other important corresponding instruction), dealloc, and, some > software, > including some web browsers (and, the vile javascript) seem to > disregard > that instruction and its importance, which is kind of like running an > internal combustion engine without a governor, or, parking a vehicle > on > a slope, without engaging the handbrake. > > Memory leakage, by its wording, appears to indicate that the memory > gets > freed, by leakage (like diarrhoea or incontinence), whereas, what > seems > to be occurring, is more like constipation, where the contents are > not > being freed, cumulatively increasing the pressure, causing the > computer > to not feel well, and "fall over".
Since 1990, Fortran has two dynamic memory facilities. One is called POINTER, which works like C pointers with malloc and dealloc (except pointer arithmetic doesn't exist in Fortran). The other is called ALLOCATABLE and is linked to procedures' dynamic scopes unless you explicitly give them the SAVE attribute (like "static" in C). As with a C pointer, if a Fortran procedure has a local POINTER without SAVE and returns without deallocating it, its target is irrevocably lost. POINTER with SAVE is like a static C pointer, so you could, in principle, deallocate it when you get back into the procedure. But if you accidentally allocate it again without deallocating it, the previous target is irrevocably lost. ALLOCATABLE in Fortran without SAVE doesn't leak. Allocating an allocated ALLOCATABLE causes a runtime error, not a memory leak. AFAIK C doesn't have anything like it. Some Fortran compilers, notably the one from NAG, provide "garbage collectors." I don't use much C or C++ or Java. Do they have garbage collectors?