home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!timbuk.cray.com!walter.cray.com!craywr!wws
- From: wws@craywr.cray.com (Walter Spector)
- Subject: Re: Dynamic Memory Allocation in FORTRAN, Question
- Message-ID: <1992Dec22.133600.1380@walter.cray.com>
- Lines: 32
- Sender: wws@craywr (Walter Spector)
- Nntp-Posting-Host: craywr.cray.com
- Organization: Cray Research, Inc.
- References: <Dec.20.02.22.20.1992.7312@spade.rutgers.edu>
- Date: 22 Dec 92 13:35:59 CST
-
- In article <Dec.20.02.22.20.1992.7312@spade.rutgers.edu>, xiong@spade.rutgers.edu (Xiong) writes:
- |> Hi, I am wondering if it is possible to allocate memory dynomically in
- |> FORTRAN as in C?
-
- There are no Standard mechanisms in the Fortran-77 Standard for performing
- dynamic memory management. Standard non-Standard ways of doing it usually
- involve overindexing blank common or some form of pointers combined with
- with a sbrk(2)-like or malloc(3c)-like interface. Performing your own
- sbrk system calls is obviously dangerous in a Unix-like environment,
- calling a malloc-like routine is more reliable.
-
- In a compiler with Fortran-90 memory management, there are two Standard
- options: Automatic arrays which are very nice for scratch arrays,
- and ALLOCATABLE variables combined with the ALLOCATE/DEALLOCATE statements
- which give a more general capability. (Note that in Fortran-90, pointers
- would generally not be used for memory management.) Compilers exist which
- support one or both of these facilities.
-
- Your compiler system will probably support one or more of the above
- techniques. RTFM for more details.
-
- |> Thanks a lot for your help. If this question has been asked before (I
- |> did not find it in the FAQ)
-
- This really is a FAQ and should be included. Keith?
-
- Walt
- ----
- Walt Spector
- (wws@renaissance.cray.com)
- Sunnyvale, California
- _._ _._ _.... _. ._.
-