From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,18020f7ae4c33348 X-Google-Attributes: gid1164f8,public From: patchkov@acs1.acs.ucalgary.ca (Serguei Patchkovskii) Subject: Re: More questions on swap space reservation Date: 1999/05/27 Message-ID: <7ik088$ib4@ds2.acs.ucalgary.ca>#1/1 X-Deja-AN: 482790206 References: <7ihcme$4c8$1@nnrp1.deja.com> <7ihnl8$boo@ds2.acs.ucalgary.ca> <7ijs42$ta2$1@nnrp1.deja.com> Organization: The University of Calgary Newsgroups: comp.sys.dec dtmoore (sponk@my-deja.com) wrote: : so. So, my question is this ... if I re-write the array declarations : using F90 dynamic allocation, will it help to alleviate my problem, or : will it just delay the swap bloating until program reaches the : allocation statments? Another way to ask this is ... under the If you allocate only the amount of space you need (rather than the largest size you might need), or if you deallocate arrays which are no longer needed, you'll do fine. Likewise, if there are some parts of the program which are never reached in a typical run, and you never get to the allocate statements, the amount of swap space you need will decrease. If neither is true, and all the memory you might conceivably need is allocated at the start of the program and lives through the whole run you will need the same amount of the swap space as in the statically dimensioned case - plus some overhead. : immediate swap mode, is the swap file size fixed when the process : starts, or will it be increased as more dynamic allocation occurs? When you use ALLOCATE in your Fortran program, your request eventually winds down to the sbrk() system routine[*], which simply attempts to extend the bss segment of your program. (This is why I told that dynamic memory is treated just like bss). In the immediate mode, this will also allocate however much swap pages is needed to swap out the new memory locations. If this cannot be done, sbrk() will return an error, which will (eventually) result in a non-zero status indication from ALLOCATE. If you don't have the STAT= attribute in the ALLOCATE, it will simply kill your program - possibly several hours (or days, or weeks) into the calculation. In this sense, a statically dimensioned Fortran-77 program running in the immediate mode is more reliable, as it is *guaranteed* not to run out of memory at any future time. (Being able to determine the maximum data size of an arbitrary program at the startup time was one of the design requirements behind Fortran-77). Being able to allocate memory dynamically is nice, but requires certain amount of discipline and a fair bit of extra error handling. Regards, /Serge.P [*] This is in fact a gross oversimplification, but it will do. -- home page: http://www.cobalt.chem.ucalgary.ca/ps/