[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: about memory



This is a general question about memory management.
can i free memory allocated to an array if I have finished using it in
the program?  suppose 
arr_a = fltarr(10000,10000)
if i don't need array arr_a anymore, would
arr_a = 0
free the memory used by arr_a?  I would expect it to now utilize only
2(or 4) bytes of memory.

this may be helpful to you, Hong.  if you have multiple Tb arrays, and
are not using them anymore in the program, you can free some memory by
initializing Tb to 0(if it works!)

-amar

William Thompson wrote:
> 
> Hong Gang <honggang@uni-bremen.de> writes:
> 
> >Hallo all,
> 
> >The following is the error given by my program.
> >      % Unable to allocate memory: to make array.
> >      Cannot allocate memory
> 
> >I have some large arrays as Tb(632*664, 880).  I do not know what is the
> >matter with the program.   Can anyone give me some idea?
> 
> IDL is telling you that the operating system is not allowing it to allocate
> enough memory to create the array.  It's not surprising; a floating point array
> of that size would take well over a gigabyte of memory.  Generally speaking,
> you'd need several times that much memory to manipulate such an array.
> 
> You don't mention what operating system you're using.  If Unix, then you can
> find out how much memory the operating system will allow you to have by
> entering in the command "limit" (before calling IDL).  You can also type
> "limit -h" to find the hard limits.  The relevant number is "datasize".  You
> can increase this, e.g. "limit datasize 200000" would give you 200 megabytes of
> memory.
> 
> Probably, you should rewrite your software to manipulate your data in pieces,
> instead of all at once.  One way to do this is to write your data to a file,
> and then use the ASSOC() function to address parts of the file.
> 
> William Thompson

-- 
*************************************************
Murphy's Law of Research:
Enough research will tend to support your theory.
*************************************************
Amar Nayegandhi
Graduate Student
Department of Computer Science,
University of South Florida, Tampa.