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.
Of course, the above is OS- and implementation-dependent;
language standards don't dictate how the OS handles memory.
But it's nearly always true under UNIX, at least.
In part this is a time optimization: it's expensive to go
out to the OS to ask for more memory. So if a subsequent
"allocate()" can satisfy its request locally, the operation will
be much faster.
If you really need to access, then release memory, consider
the use of the POSIX mmap/munmap routines.
-P.
On Thu, 6 Feb 2003, 11:46am -0500, [log in to unmask] wrote:
> Hi everyone,
> I am a new user of Fortran 90.
> I have a program which produces the int single-linked list very often.
> And I found the memory is getting biger and run out of it at last.
> I am sure that I deallocated the int node when I removed it. But I only
> nullify the head and the tail of the int list when I don't need the int
> list. Do the int nodes still own memory after I nullify the head and the
> tail? If do, how can I release the memory of an int list? Deallocate
> the int list or deallocate the int node one by one?
>
> Thanks.
>
> Junchao Xia
> Physics Department, Clark University
> Worcester, MA 01610, USA
> or
> #6 Shirley Street, Apartment #1,
> Worcester, MA 01610, USA
> tele: (508)793-7727(office),(508)767-0395(home)
> (508)793-7150(lab)
> Email: [log in to unmask],
> [log in to unmask],
> [log in to unmask]
> URL: http://physics.clarku.edu/~jcxia/
> _______________________________________
>
--
Peter S. Shenkin Schrodinger, Inc.
VP, Software Development 120 W. 45th St.
646 366 9555 x111 Tel New York, NY 10036
646 366 9550 FAX [log in to unmask]
http://www.schrodinger.com
Pre-arranged conf. calls: 702-759-8420 or 888-867-7084; passcode 646-366
|