# Inline C and Memory

**URL:** <https://www.ruby-forum.com/t/inline-c-and-memory/108120>\
**Category:** Ruby\
**Created:** [June 29, 2007, 5:53am UTC](https://www.ruby-forum.com/t/inline-c-and-memory/108120 "2007-06-29T05:53:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chillexistence](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@chillexistence](https://www.ruby-forum.com/u/chillexistence)\
**Post date:** [June 29, 2007, 5:53am UTC](https://www.ruby-forum.com/t/inline-c-and-memory/108120/1 "2007-06-29T05:53:36Z")

</div>

So the more objects you store in ruby the longer mark and sweep takes  
for GC because there are more objects to iterate over. Makes sense.

If you have a machine with 8 gigs of RAM and want to fill up all the  
memory to take advantage of it, can you will Ruby and Inline C?

So, the example Inline C looks like:

require ‘rubygems’  
require ‘inline’

class Example  
inline(:C) do |builder|  
builder.c “int method\_test1() {  
int x = 10;  
return x;  
}”  
end  
end

p Example.new.method\_test1

But would it be possible inside method\_test1 to do complex memory  
allocation and use all 8 gigs of RAM without all the ruby marking and  
sweeping?

Thanks.
