comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Unable to allocate memory: to make an array. Not enough space
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Unable to allocate memory: to make an array. Not enough space [message #91765 is a reply to message #91764] Mon, 24 August 2015 14:13 Go to previous messageGo to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Monday, August 24, 2015 at 3:43:34 PM UTC-5, fd_...@mail.com wrote:
> Hi
>
> I have a 4D array A = [240,256,256,10] and I call this array into FOR loops as a 3D array.
>
> Data = A
>
> FOR k=0L, 9 DO BEGIN ;looping over levels
> A = A[*,*,*,k]
>
> FOR l=0L,n_elements(N)-1 DO BEGIN
>
> FOR iter=1L,1 DO BEGIN
>
> ENDFOR
> ENDFOR
> A = Data
> ENDFOR
>
> I set the A=Data because in the next level (k=1) I wanted the matrix to be 4D otherwise it's 3D [240,256,256] and I've got the following error. 'Attempt to subscript ARRAYSOURCE with K is out of range.'
>
> Once I set the A = Data I got this error 'Unable to allocate memory: to make an array. Not enough space'. Can anyone please help with this?

At that point, you're asking for 2 copies of the 4D array -- one in Data and one in A. And you don't have enough memory to do that!

What you want to do is change this line:

A = A[*,*,*,k]

to

A = Data[*,*,*,k]

and then completely get rid of the "A = Data" at the end. This way, you only ever need one copy of the 4D array at a time, and A just gets assigned to the relevant slice.

(incidentally, is there a good reason why you can't operate directly on the 4D array, and completely avoid making a copy of the 3D slice?)

-Jeremy.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Plot and Legend problem
Next Topic: Mean = NaN if NaN present

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:18:59 PDT 2025

Total time taken to generate the page: 0.00188 seconds