Re: Memory allocation problems [message #58073] |
Wed, 16 January 2008 08:02 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Anne writes:
> Whoops - I forgot to check the oracle first before posting, sorry
> about that!
Well, it's hard to find. For some reason, I remember "ton of memory"
and that's how I find it. :-)
> I have now read and attempted to digest the article you point to but
> although it explains why I have a problem I'm not sure that I can see
> a solution at the moment! I may just take the cowards way out and
> cycle through each colour plane separately. Then I'll go and nag the
> computer support guys to finish setting up my shiny new linux box with
> 64bit access to 16Gb RAM! That'll make the problem go away for a wile
> until the histology people produce even bigger images!
> Thanks for the incredibly speedy response to the post,
I've got my own problems this morning (map projections!), so
I can't really help, but I think pre-constructing your own
set of indices ahead of the subsetting is the way to go.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: Memory allocation problems [message #58075 is a reply to message #58073] |
Wed, 16 January 2008 07:46  |
Anne[1]
Messages: 8 Registered: February 2006
|
Junior Member |
|
|
On Jan 16, 9:55 am, David Fanning <n...@dfanning.com> wrote:
> You are running into the ol' "it takes a TON of memory to
> subscript an array" problem:
>
> http://www.dfanning.com/misc_tips/submemory.html
>
> You can read the article for some suggestions on how to
> approach the problem.
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Whoops - I forgot to check the oracle first before posting, sorry
about that!
I have now read and attempted to digest the article you point to but
although it explains why I have a problem I'm not sure that I can see
a solution at the moment! I may just take the cowards way out and
cycle through each colour plane separately. Then I'll go and nag the
computer support guys to finish setting up my shiny new linux box with
64bit access to 16Gb RAM! That'll make the problem go away for a wile
until the histology people produce even bigger images!
Thanks for the incredibly speedy response to the post,
Anne
|
|
|
Re: Memory allocation problems [message #58076 is a reply to message #58075] |
Wed, 16 January 2008 06:55  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Anne writes:
> I'm trying to create a pyramid of smaller images from a very large
> initial image and have run into a strange memory allocation problem.
> My assumption is that I'm messing up somehow but I can't see where.
>
> My initial image, im, is a [3,9000,8000] array and I'm trying to
> assign a subset of the image to an [8192,8192] array (powers of 2 are
> necessary for my application)
>
> The bit of code that's causing me trouble is
>>> tileIm=bytarr(3,tile*scale,tile*scale) (scale=16 so tileim is [3,8192,8192])
>>> imsize = size(im)
>>> ydim = imSize[3] - low_y
>>> tileIm[*,*,0:ydim-1] = im[0:2,low_x:high_x,low_y:imSize[3]-1]
>
> (low_x = 0, high_x = 819, 1ow_y = 0, high_y = 8191 for this particular
> iteration)
>
> This gives me the message
> % Unable to allocate memory: to make array.
>
> But I do have memory available on my system (2Gb in total available)
>
> I can allocate the segment to a new variable, ie
>>> test = im[0:2,low_x:high_x,low_y:imSize[3]-1]
> but surely that requires even more memory?
>
> If I then try
> IDL> tileIm[*,*,0:ydim-1] = test
> % Unable to allocate memory: to make array.
>
> I can't use temporary as I need the original image im for subsequent
> iterations
> What am I doing wrong. Is there a work around?
You are running into the ol' "it takes a TON of memory to
subscript an array" problem:
http://www.dfanning.com/misc_tips/submemory.html
You can read the article for some suggestions on how to
approach the problem.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|