What your describing is incorrect programming, but it will work correctly in
most implementations of malloc/free. Freeing generally just puts
the freed memory on a 'free list', but does not actually write
over the memory; this would typically happen after a subsequent malloc.
free() returns memory to malloc's "arena", which *belongs to the process*;
it does not (as one might expect) return memory to the operating system.
Under Unix, a program doing dynamic allocation with malloc/free will
grow but will never shrink in size.
On Thu, 10 Nov 1994, Johann Friedrich Heinrichmeyer wrote:
>
> deallocation schemes did not lead to errors. Linked list where
> deallocated by first freeing structures and then evaluating the
> list->next pointers (at a time where the memory was no more valid). It
> worked absolutely relyable. We suspect since them that free() is only a
> empty function (simple return) on some workstations:-). Also the memory
> consumption of "perl" leads to this assumption.
>
>
> --
> Fritz Heinrichmeyer FernUniversitaet Hagen
> FAX: +49 2371/5221 LG Elektronische Schaltungen
> EMAIL: fritz.heinrichmeyer_at_fernuni-hagen.de Frauenstuhlweg 31
> PHONE: +49 02371/566-243 58644 Iserlohn (Germany)
> WWW: http://ES-sun2.fernuni-hagen.de
>
>
Received on Mon Dec 19 1994 - 22:43:18 CET