Re: Solve memory problems [message #64687 is a reply to message #64623] |
Wed, 14 January 2009 04:55   |
Jean H.
Messages: 472 Registered: July 2006
|
Senior Member |
|
|
David Fanning wrote:
> Jean H. writes:
>
>> if not already in use, using pointers can be of great help. You can save
>> each band in a different pointer, or even each line etc. Therefore, the
>> size of the required contiguous memory space decreases.
>
> I was so upset with the HEAP_GC suggestion this morning
> that I forgot to respond to this. But I don't immediately
> see how this will help, unless, of course you have some
> ability to read all three bands from the file as bands
> and not as an image.
>
> Otherwise, I think you would have to allocate twice
> the image size to do the transfer to pointers.
>
> Plus, you have to put the bands together again to display
> the image, so I don't see where I am ahead of anything
> here. What am I missing?
>
> Cheers,
>
> David
Hi,
Agreed for the memory cost associated with loading the data... but down
the road (or down the program), it might still be useful to save
memory.. for example, if the routine that is being called needs 10 times
the memory of the input.
In my own program, I do all the analysis on a modified version of my
original image (a classified land-use map, with the background values
removed so the data is a 1D array), then, at the very end, I
re-transform it to save and display it. I save a lot of memory!
Moreover, all bands are saved in pointers, allowing the program to run
on almost any computer, while the original version, which did not use
much pointer, was making my work-beast run out of memory fairly quickly!
Jean
|
|
|