X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 22 Oct 2014 06:01 AM by  anon
Unable to allocate memory to make array
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
22 Oct 2014 06:01 AM
    Hello all, I am trying to get the number of occurences of values higher than 100 in arrays and always get a 'Unable to allocate memory' error on large arrays. I do not wish to increase my virtual memory, which is currently set to 3GB. Here is my code: a=UINDGEN(2000,6000,150) a GE= 100 b=TOTAL(a) I get the memory allocation error on the second line. Is there a way to achieve this? Thank you for reading (and helping if you can!).

    Deleted User



    New Member


    Posts:7
    New Member


    --
    11 Nov 2014 05:12 AM
    Good morning Marie, Well, your variable A makes more than 3Gb of size (2000x6000x150x2), so you are very close to your memory limit. Your second line should perform the operation without any extra memory BUT I suspect it does it due to the data type change. I mean, when you type something like A+=1 there is no problem because the result of A+1 has the same data type as A and the operation is performed in place. But your comparison A GT 100 returns a BYTE result and A is UINT, so I suspect that IDL is creating a temporary variable to run your comparison and then assign it to A. This is why memory is collapsed. If you need to manage data of such a huge size I suggest you to use some kind of "tiling" mechanism. I mean, try to separate your data in smaller pieces, process them and gather all the results. In your case you could do something like: a=UINDGEN(2000,6000,150) b=0 for i=0,149 do b+=TOTAL(a ge 100) Imanol
    You are not authorized to post a reply.