This is exactly what Van Snyder described (para.5).
Qolin
[log in to unmask]
+44 777 182 5542
----- Original Message -----
From: "robin" <[log in to unmask]>
To: <[log in to unmask]>
Sent: Friday, June 25, 2010 2:15 AM
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
|