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

Home » Public Forums » archive » Memory allocation problem:
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
Memory allocation problem: [message #11016] Fri, 20 February 1998 00:00 Go to next message
Inigo Garcia is currently offline  Inigo Garcia
Messages: 13
Registered: June 1997
Junior Member
I think this is a bug in IDL, probably someone else has noticed it before:
If I create a huge array, and then delete it, the allocated memory still remains
!!! Look a clear example:

IDL> a=fltarr(10000,50000)
IDL> a=0

The array is not there any more, so the allocated memory should be freed,
shouldn't it ? But it is not. And I don't like the idea of exiting IDL everytime I
decide to use some big temporary arrays, I find it ridiculous. If these 2 lines
are within a routine, the problem is exctly the same.

I am in a Sun UltraSparc, with Solaris and IDL 5.0.2.

Please, any solutions will be appreciated.

I~nigo.
--
\\|//
(o o)
+-----------------------oOOo-(_)-oOOo----------------------- --+
| I~nigo Garcia Ruiz |
| Kapteyn Instituut Phone: +31-(0)50-3634083 |
| Landleven 12 Fax: +31-(0)50-3636100 |
| 9747 AD GRONINGEN (Netherlands) e-mail: iruiz@astro.rug.nl |
+----------------------------------------------------------- --+
Re: Memory allocation problem: [message #11156 is a reply to message #11016] Fri, 27 February 1998 00:00 Go to previous message
David Kastrup is currently offline  David Kastrup
Messages: 33
Registered: February 1998
Member
jyli@anchor.gsfc.nasa.gov (Jason Li) writes:

> David Fanning (davidf@dfanning.com) wrote:
>
> : This is a result of IDL being written in C and using the C library
> : functions (malloc and free) for memory allocation. In most C libraries,
> : memory that is freed is NOT returned to the operating system. The C
> : program retains this memory and will reuse it for future calls to malloc
> : (assuming that the new allocation will fit in the freed block).
>
> Retains this memory for how long?
> (1) life of a subroutine
> (2) life of a main routine
> (3) life of an IDL session

(3). However, glibc, the library used in newer versions of Linux (for
exmaple) will allocate larger chunks of memory with a different
mechanism making it possible to return such larger pieces of memory to
the operating system the moment they are freed, regardless of
allocation order.

The main advantage of this scheme is not as large as one would na�vely
be let to think, as unused memory tends to get swapped out, anyway,
when memory gets scarce. But at least this avoids more useful memory
pieces to be swapped out instead (causing a bit of thrashing) and it
reduces the general impact on swap space related resources.

If you are concerned about proper resource utilization, you should
choose your operating system accordingly.


--
David Kastrup Phone: +49-234-700-5570
Email: dak@neuroinformatik.ruhr-uni-bochum.de Fax: +49-234-709-4209
Institut f�r Neuroinformatik, Universit�tsstr. 150, 44780 Bochum, Germany
Re: Memory allocation problem: [message #11175 is a reply to message #11016] Wed, 25 February 1998 00:00 Go to previous message
jyli is currently offline  jyli
Messages: 21
Registered: November 1995
Junior Member
David Fanning (davidf@dfanning.com) wrote:

: This is a result of IDL being written in C and using the C library
: functions (malloc and free) for memory allocation. In most C libraries,
: memory that is freed is NOT returned to the operating system. The C
: program retains this memory and will reuse it for future calls to malloc
: (assuming that the new allocation will fit in the freed block).

Retains this memory for how long?
(1) life of a subroutine
(2) life of a main routine
(3) life of an IDL session

thanks

--

------------------------------------------------------------ ------------
Jason Y. Li | Tel : (301) 286-1029
Climate and Radiation Branch | Fax : (301) 286-1759
NASA Goddard Space Flight Center | WWW : http://climate.gsfc.nasa.gov
Greenbelt, MD 20771, USA | Email: jyli@climate.gsfc.nasa.gov
------------------------------------------------------------ ------------
Beauty of style, harmony, grace and good rhythm depend on simplicity.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: project_vol() in IDL
Next Topic: New dialog routines

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

Current Time: Wed Oct 08 19:39:12 PDT 2025

Total time taken to generate the page: 0.00537 seconds