[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strange memory problem
- Subject: Re: Strange memory problem
- From: Alex Schuster <alex(at)pet.mpin-koeln.mpg.de>
- Date: Wed, 22 Dec 1999 17:09:30 +0100
- Newsgroups: comp.lang.idl-pvwave
- Organization: Regional Computing Center, University of Cologne
- References: <83ov5i$nb8$1@SonOfMaze.dpo.uab.edu>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:17835
"R. Kyle Justice" wrote:
> When I do the following:
>
> temp=bytarr(1000,1000,25)
> temp(*)=10
>
> my computer (a Sparc20 with 128MB of *available* ram) grinds
> to a halt. Actually it starts using swap. Don't tell me
> PV-Wave is making 5 or 6 copies of the array just to do this
> simple process!
>
> Has anyone else seen this curious behavior on PV-Wave? IDL? I have
> verified it on a PC, and using different versions of PV-Wave(6.1,7.0).
Yes, I encountered the same problem. It seems that, when using the (*)
notation, IDL (and probably also PV-WAVE) replaces the * by an
appropiate index list, like here:
temp = bytarr(1000,1000,25)
index = lindgen(25000000L)
temp(index) = 10B
This index list takes 100 MB of memory! You can check this by the
command HELP, /MEMORY.
As others have pointed out, it is much faster when you use something
like this:
temp = bytarr(1000,1000,25)+10B
(Don't forget the B, because you would get an INTARR instead.)
This is much faster, and you need only 25 MB of RAM, as one would
expect.
Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de