# Know can I know how much object has been created?

**URL:** <https://www.ruby-forum.com/t/know-can-i-know-how-much-object-has-been-created/93371>\
**Category:** Ruby\
**Created:** [March 31, 2006, 9:11pm UTC](https://www.ruby-forum.com/t/know-can-i-know-how-much-object-has-been-created/93371 "2006-03-31T21:11:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 31, 2006, 9:11pm UTC](https://www.ruby-forum.com/t/know-can-i-know-how-much-object-has-been-created/93371/1 "2006-03-31T21:11:17Z")

</div>

Hi,

We have an application which is very time and ressource consuming, so  
we would like to know how to monitoring the number of object created  
and the size of memory used by ruby? is there any API that we can use  
or where can I find the documentation about this???

Thanks you very much

sayoyo

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 31, 2006, 9:29pm UTC](https://www.ruby-forum.com/t/know-can-i-know-how-much-object-has-been-created/93371/2 "2006-03-31T21:29:41Z")

</div>

removed\_email\_address@domain.invalid wrote:

> Hi,
> 
> We have an application which is very time and ressource consuming, so  
> we would like to know how to monitoring the number of object created  
> and the size of memory used by ruby? is there any API that we can use  
> or where can I find the documentation about this???

Not much info to go on, but assuming you’ve ascertained it’s not bound  
by network latencies, or web or database server latencies:

Object counts: something like:  
c=Hash.new(0); ObjectSpace.each\_object {|obj| c[obj.class]+=1}; pp  
c.sort\_by {|k,v| -v}

## [http://www.rubygarden.org/ruby?NewProfiler](http://www.rubygarden.org/ruby?NewProfiler)

background info on Memory/ GC:

[http://del.icio.us/tag/ruby+gc](http://del.icio.us/tag/ruby+gc)

[http://whytheluckystiff.net/articles/theFullyUpturnedBin.html](http://whytheluckystiff.net/articles/theFullyUpturnedBin.html)

> **[WebMD - Better information. Better health.](https://www.webmd.com/?GCAndMemoryManagement)**
>
> The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...

---

<div class="post-metadata">

**Author:** ![sayoyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ba8739/32.png) [@sayoyo](https://www.ruby-forum.com/u/sayoyo)\
**Post date:** [March 31, 2006, 10:15pm UTC](https://www.ruby-forum.com/t/know-can-i-know-how-much-object-has-been-created/93371/3 "2006-03-31T22:15:23Z")

</div>

Thanks you very much for the information:)!!!

Sayoyo
