comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Array Subscripting Memory Usage (watch out!)
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Array Subscripting Memory Usage (watch out!) [message #32327] Wed, 02 October 2002 16:23 Go to next message
Andre Kyme is currently offline  Andre Kyme
Messages: 19
Registered: September 2001
Junior Member
Dick Jackson wrote:

> Hi all,
>
> This may be old news to some of you, but it surprised me and a couple of
> colleagues, and I couldn't find any discussion of it on this group, so
> I'll share it around.
>
> I was surprised to find how much memory is used during access to a
> subset of an array. I ran this, which makes a 1000x1000 array, and
> accesses a subset of it using an array of subscripts:
>
> a = bindgen(1000, 1000)
> subscripts = Long(RandomU(seed, 500)*1000)
> baseMem = (memory())[0]
> help, a[subscripts, *]
> highWaterMem = (memory())[3]
> Print, 'Memory used during access: ', highWaterMem-baseMem
>
> IDL> .GO
> <Expression> BYTE = Array[500, 1000]
> Memory used during access: 2500076
>
> The array being extracted is 0.5 million bytes, but it took 2.5 million
> bytes to do it! I'm guessing that there's a Long array being made behind
> the scenes that contains the indices of the elements I'm going to get
> back.

Dick, I ran your little program on IDL5.5 (Solaris 9) and got the following
output:

<Expression> BYTE = Array[500, 1000]
Memory used during access: 4500128

Yikes, I get 9N bytes needed to extract an N byte array!

Andre
Re: Array Subscripting Memory Usage (watch out!) [message #32418 is a reply to message #32327] Thu, 03 October 2002 03:40 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Andre Kyme wrote:

> Dick Jackson wrote:
>
>> Hi all,
>>
>> This may be old news to some of you, but it surprised me and a couple of
>> colleagues, and I couldn't find any discussion of it on this group, so
>> I'll share it around.
>>
>> I was surprised to find how much memory is used during access to a
>> subset of an array. I ran this, which makes a 1000x1000 array, and
>> accesses a subset of it using an array of subscripts:
>>
>> a = bindgen(1000, 1000)
>> subscripts = Long(RandomU(seed, 500)*1000)
>> baseMem = (memory())[0]
>> help, a[subscripts, *]
>> highWaterMem = (memory())[3]
>> Print, 'Memory used during access: ', highWaterMem-baseMem
>>
>> IDL> .GO
>> <Expression> BYTE = Array[500, 1000]
>> Memory used during access: 2500076
>>
>> The array being extracted is 0.5 million bytes, but it took 2.5 million
>> bytes to do it! I'm guessing that there's a Long array being made behind
>> the scenes that contains the indices of the elements I'm going to get
>> back.
>
> Dick, I ran your little program on IDL5.5 (Solaris 9) and got the
> following output:
>
> <Expression> BYTE = Array[500, 1000]
> Memory used during access: 4500128
>
> Yikes, I get 9N bytes needed to extract an N byte array!
>
> Andre

Dear Andre
did you have set LONG by compile_option to 64bit Long?

Reimar


--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: formatting output from caldat to label animation frames
Next Topic: setting zbuffer for rendering window/buffer

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:56:44 PDT 2025

Total time taken to generate the page: 0.00679 seconds