Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Determine memeory usage of Arrays or other objects

Reply
Thread Tools

Determine memeory usage of Arrays or other objects

 
 
john maclean
Guest
Posts: n/a
 
      02-25-2009
k = [nil] *50000

is there a way to get some idea of how much memory k will use, or even
how much mem it may use as k.size changes?

ruby -e 'p Array.methods.sort' does not show anything obvious.

--
John Maclean
07739 171 531
MSc (DIC)

Timezone: GMT

 
Reply With Quote
 
 
 
 
Robert Klemme
Guest
Posts: n/a
 
      02-25-2009
On 25.02.2009 18:16, john maclean wrote:
> k = [nil] *50000
>
> is there a way to get some idea of how much memory k will use, or even
> how much mem it may use as k.size changes?
>
> ruby -e 'p Array.methods.sort' does not show anything obvious.


And there isn't an obvious solution. You can check the archives - this
discussion comes up from time to time. Basically it is unclear what
"memory taken up by an object" means. The simplest answer is the amount
of memory that is needed to store the object itself. But what about
references? Do you count objects in that are referenced by the Array?
If so, how many levels do you track? Etc. You even might not find your
memory problem by only looking at Array memory (assuming you have a
memory issue).

Kind regards

robert
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Implementing STL container in shared memeory Pallav singh C++ 2 12-24-2007 11:35 AM
memeory related subrat C++ 10 12-11-2006 03:24 PM
System Memeory Ravi Java 11 03-30-2006 04:07 PM
Formatting memeory cards 52North Digital Photography 2 11-09-2005 03:53 PM
Secure Digial Memeory Rich Digital Photography 12 05-17-2005 06:03 PM



Advertisments