How to find free memory? 
Author Message
 How to find free memory?

Is there a function to check available memory which is a built-in to Perl?
I'd like to only add an associative array (or traditional array) element
if I know that memory is greater than $some_value.  I'm using MacPerl,
in this case, so a Unix system call doesn't help too much, but I'm curious
what the answer is for Unix, too.

Perl4, Perl5, I'm not too picky.

En paz,
Steve
--
Stephen W. Thompson, U. of PA, Data Administration, 215-898-1236

URL: http://www.*-*-*.com/ ~thompson



Fri, 14 Aug 1998 03:00:00 GMT  
 How to find free memory?


 S> Is there a function to check available memory which is a built-in to Perl?
 S> I'd like to only add an associative array (or traditional array) element
 S> if I know that memory is greater than $some_value.  I'm using MacPerl,
 S> in this case, so a Unix system call doesn't help too much, but I'm curious
 S> what the answer is for Unix, too.
 S>

Not a built-in, but if you're worried about having enough memory,
you could do something like this:

eval { %big_one = map { $_ => "typical_storage_size", } 0..$how_big_you_want };

   ...      

Quote:

   ...
} else {    # ok

   ..

Not sure if MacPerl can cope with this though.

HTH,

Charles DeRykus



Fri, 14 Aug 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. perl memory management - does @array = () free the memory?

2. freeing memory for real in perl5

3. Freeing up memory

4. Need help freeing memory...

5. Freeing perl memory?

6. Gurus: does UNDEF free memory?

7. freeing memory

8. how to free memory properly ?

9. Freeing Memory

10. Memory problems - how to free up

11. IPC::Shareable not freeing memory

12. sv_setpvn & freeing buffer memory

 

 
Powered by phpBB® Forum Software