Peter Shenkin writes:
> Fortran "deallocate()", like C's "free()", rarely actually
> returns memory to the OS. Thus, program memory, when
> observed using an external tool, will not decrease; it
> will only increase. The freed memory remains associated
> with the process and is availble for re-use the next time you
> "allocate()" an object.
But for the original poster's question, not even that much happens.
When he deallocates only the head and tail, the other nodes aren't
freed in any sense. They are not available for reuse next time
you allocate something. The only way they will ever get freed is
if the compiler has a garbage collector. (It would have to be
a pretty sophisticated garbage collector to catch this one because
all of the nodes would still have something pointing to them, so
the garbage collector would have to notice that the whole set of
nodes was "closed". Though certainly possible, I'm not sure that
there exist any garbage collectors that sophisticated in actual use.)
--
Richard Maine | Good judgment comes from experience;
[log in to unmask] | experience comes from bad judgment.
| -- Mark Twain
|