Re: assoc() allocates memory... why? [message #5844] |
Sat, 17 February 1996 00:00 |
Jackel
Messages: 30 Registered: April 1993
|
Member |
|
|
In article <4g3cm9$p4i@peabody.colorado.edu> tarrall@plutus.Colorado.EDU (Robert Tarrall) writes:
> This is re. vanilla IDL 4.0.1, not PV-Wave, but I'm posting here as
> the comp.lang.idl newsgroup looks dead, at least at our site.
As I understand it, comp.lang.idl was already taken by the interface
description language people.
> The IDL documentation claims quite clearly that assoc() does not
> hold the data from the associated file in memory. However, it still
> seems to allocate the memory; under both IRIX and SunOS when I
> do something like:
> openr,1,"bigfile"
> x = assoc(1,fltarr(1000,301,180))
> all the memory necessary to hold a 1000x301x180 array of floats
> (i.e. 215 MB) is allocated by IDL. This seems very inefficient
> at best and perhaps even just plain dumb...
You telling IDL that the file has N elements in it, each of which are
1000x301x180 floats, so it naturally creates a buffer this large. If you have
a file with 1000 300x180 floats, then try
x= ASSOC(1,FLTARR(301,180))
which allows you to access the 200th element with
x1= x(200)
|
|
|