Print

Print


I really like that.  I think it will work and it's really simple.  Thank you!

-----Original Message-----
From: Fortran 90 List [mailto:[log in to unmask]] On Behalf Of robin
Sent: Thursday, June 24, 2010 9:15 PM
To: [log in to unmask]
Subject: Re: Memory management question

What about this:

Call your memory manager to provide you with the
starting position of the array and the number of elements.
(or the final position).

As soon as you pass that "slab" to a subroutine --
e,g., call mysub(Memory(sp:fp))
you have the slab of memory available in the subroutine,
and its elements start from position 1.

__________________
From: "Greenberg, Naomi" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Friday, 25 June 2010 5:42 AM
Subject: Re: Memory management question


I'll try to clarify with an example. What I want to do is replace:
   Real, allocatable :: array1(:), array2(:), array(3)
   Allocate (array1(7000))
   Allocate (array2(444))
   ...
   Deallocate (array1)
   Allocate (array1(33333))
  Etc. with something like
  Initialize up front, once: allocate Memory(100000)

   Real, allocatable :: array1(:), array2(:), array(3)
   Call allocMemMgr ( 7000, array1 )
   Call allocMemMgr ( 444, array2 )
  Etc. and have array1(100) be addressable in the main program.  The only thing I can think of is having the manager
return a start location and having the user of this manager explicitly use Memory(startLoc:startLoc+size) instead of an
array.

   Even were I to use equivalence, I'd have to declare each array a fixed size before equivalencing it to
Memory(startLoc), wouldn't I?  And this size changes during the program.  So equivalence won't work.  I'm no expert on
pointers, but I thought they were dynamically allocated as well, which would defeat my purpose. This application will be
running for many days and will be dividing a huge matrix into pieces of varying sizes, doing operations on them, and
then moving on to process other pieces of the matrix.

Thanks,
Naomi


__________ Information from ESET NOD32 Antivirus, version of virus signature database 5227 (20100624) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com



__________ Information from ESET NOD32 Antivirus, version of virus signature database 5227 (20100624) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com