# Cairo or Gtk::DrawingArea memory leak?

**URL:** <https://www.ruby-forum.com/t/cairo-or-gtk-drawingarea-memory-leak/245740>\
**Category:** Ruby-Gnome 2\
**Created:** [July 9, 2013, 6:23pm UTC](https://www.ruby-forum.com/t/cairo-or-gtk-drawingarea-memory-leak/245740 "2013-07-09T18:23:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [July 9, 2013, 6:23pm UTC](https://www.ruby-forum.com/t/cairo-or-gtk-drawingarea-memory-leak/245740/1 "2013-07-09T18:23:36Z")

</div>

Trying to figure out what I am doing wrong.  
Whenever I run this code it starts using up all my ram but no process  
shows up as using the ram but the task manager shows ram usage going up  
until the computer starts hanging.

are you suppsoed to save the cairo context and use the same one over and  
over again or run this line of code every time you draw?

cr = window.create\_cairo\_context

here is the simple program I started with and it hangs my computer if I  
let it run for a minute or two.

> <https://gist.github.com/anonymous/de637935fee203170b9b>

here is the gem list:  
atk (2.0.2)  
bundler (1.3.5)  
cairo (1.12.6)  
gdk\_pixbuf2 (2.0.2)  
glib2 (2.0.2)  
gtk2 (2.0.2)  
pango (2.0.2)  
pkg-config (1.1.4)  
rake (10.0.4)  
rubygems-bundler (1.1.1)  
rvm (1.11.3.7)

---

<div class="post-metadata">

**Author:** ![adamonduty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@adamonduty](https://www.ruby-forum.com/u/adamonduty)\
**Post date:** [July 11, 2013, 12:16am UTC](https://www.ruby-forum.com/t/cairo-or-gtk-drawingarea-memory-leak/245740/2 "2013-07-11T00:16:26Z")

</div>

switched ruby version with rvm to 1.9.3 from 2.0 and installed the  
previous version of gtk2 on 1.9.3 and now it seems to work.

---

<div class="post-metadata">

**Author:** ![adamonduty](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/5fc32e/32.png) [@adamonduty](https://www.ruby-forum.com/u/adamonduty)\
**Post date:** [July 11, 2013, 4:27am UTC](https://www.ruby-forum.com/t/cairo-or-gtk-drawingarea-memory-leak/245740/3 "2013-07-11T04:27:41Z")

</div>

I have tested your code on Windows, with Ruby 2.0.0 p0, with gtk 2.0.2,  
and  
haven’t ran into any issues with memory leakage.

On Wed, Jul 10, 2013 at 6:16 PM, none nope \<  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)\> wrote:

> Isolate bottlenecks and diagnose root cause in seconds.  
> Start your free trial of AppDynamics Pro today!  
> [http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk](http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk)
> 
> * * *
> 
> ruby-gnome2-devel-en mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

–  
Mario S.  
Fleet Captain  
CO - Geo 99  
CO - USS T’hy’la  
XO - Diplomatic Corps - Second Life  
[http://www.iftcommand.com/chapters/thyla/](http://www.iftcommand.com/chapters/thyla/)

> **[HOME | The Federation](https://www.trekfederation.com)**
