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

Home » Public Forums » archive » Strange memory consumption?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Strange memory consumption? [message #13159] Fri, 16 October 1998 00:00
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
I just noticed this:

IDL> a = bindgen( 1000, 1000, 10 )
IDL> help, /mem
heap memory used: 10183855, max: 10183883, gets: 188,
frees: 61
IDL> a[*] = 1b
IDL> help, /mem
heap memory used: 10183906, max: 50183966, gets: 192,
frees: 63

I create a 10 MB array, and initialize it, using the [*] notation. It
seems that the asterisk is substituted by a lindgen(10000000L), which
takes another 40 MB! And I always believed this method was very
efficient.
This workaround does it better:

IDL> a = bindgen( 1000, 1000, 10 )
IDL> help, /mem
heap memory used: 10183855, max: 10183883, gets: 188,
frees: 61
IDL> a = temporary(a) * 0b + 1b
IDL> help, /mem
heap memory used: 10183920, max: 10183948, gets: 191,
frees: 62

Voila, no additional memory needed. This is also a lot faster.



** Structure !VERSION, 5 tags, length=40:
ARCH STRING 'sparc'
OS STRING 'sunos'
OS_FAMILY STRING 'unix'
RELEASE STRING '5.1'
BUILD_DATE STRING 'Apr 13 1998'


Alex
--
Alex Schuster Wonko@weird.cologne.de PGP Key available
alex@pet.mpin-koeln.mpg.de
[Message index]
 
Read Message
Previous Topic: Re: CATCH command
Next Topic: Re: Large array indices

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

Current Time: Sat Oct 11 16:06:19 PDT 2025

Total time taken to generate the page: 0.55815 seconds