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

Home » Public Forums » archive » Re: 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
Re: Strange memory consumption? [message #13155] Fri, 16 October 1998 00:00 Go to previous message
Alex Schuster is currently offline  Alex Schuster
Messages: 124
Registered: February 1997
Senior Member
Kevin Ivory wrote:

> Alex Schuster wrote:
>> 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
>
> Hi Alex,
>
> I wasn't aware of that, but I would do it differently in the first place.
> If you know you want to initialize an array with a constant, there are
> much better ways of doing so. First of all, use bytarr instead of
> bindgen. Then you only have to add the constant you need:
>
> a = bytarr(1000, 1000, 10) + 1b

Oh, sorry I didn't make ths clear. Of course you are right, but my code
was intended as some example only in order to demonstrate the effect.
But it occurs several times in my program that I have a huge array and
have to re-initialize it to zero. I didn't expect that creating the
array again would be faster than using arr[*]=0, and that this costs
that much memory.


> There is another way of defining and inititializing an array in one step:
>
> a = make_array(1000, 1000, 10, value=1b)
>
> Initializing such large arrays, you might want to check the time
> consumption: On my system (Pentium 200 MHz, IDL 5.1.1 Linux, 64 MB RAM)
> the first assignment takes roughly 0.8s, the second takes 1.9s.
> (Your code takes 2 minutes! - probably because of swapping to hard disk)

Here it's around 0.3s vs. 1.7s, on an UltraSparc with enough memory.









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

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

Current Time: Wed Oct 08 18:11:54 PDT 2025

Total time taken to generate the page: 0.00447 seconds