<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,6 +16,7 @@ module Roby
 end
 
 require 'drb'
+require 'weakref'
 require 'pp'
 require 'thread'
 require 'set'</diff>
      <filename>lib/roby.rb</filename>
    </modified>
    <modified>
      <diff>@@ -12,9 +12,24 @@ module Roby
 	end
 
 	attr_accessor :propagation_id, :context, :time
-	attr_accessor :sources
 	protected :propagation_id=, :context=, :time=
 
+        def sources
+            result = []
+            sources.delete_if do |ref|
+                obj = begin 
+                          ref.__getobj__
+                      rescue WeakRef::RefError
+                      end
+                if obj
+                    result &lt;&lt; obj
+                end
+            end
+        end
+        def sources=(sources)
+            @sources = sources.map { |obj| WeakRef.new(obj) }
+        end
+
 	# To be used in the event generators ::new methods, when we need to reemit
 	# an event while changing its 
 	def reemit(new_id, new_context = nil)</diff>
      <filename>lib/roby/event.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4776933709160b138d1b1859f25a15144544a867</id>
    </parent>
  </parents>
  <author>
    <name>Sylvain Joyeux</name>
    <email>sylvain.joyeux@m4x.org</email>
  </author>
  <url>http://github.com/doudou/roby/commit/926ab1e83cf86a395e468448be19a534fc72a0f6</url>
  <id>926ab1e83cf86a395e468448be19a534fc72a0f6</id>
  <committed-date>2008-06-01T13:28:47-07:00</committed-date>
  <authored-date>2008-06-01T13:28:47-07:00</authored-date>
  <message>[core] fix memory leak in Event

  Until now, Event#source was keeping around the sources of propagation.
  Since the sources themselves were keeping their sources -- and since
  Event keeps references on generator and tasks -- it was potentially a
  source of memory leak for long-running high-level tasks.

  This patch references the event sources by using WeakRef. That should
  not be a problem since #sources is not used often (mainly in error
  handling)</message>
  <tree>79625dc7b41c5329ab2f4736f02d0031fbb86fcf</tree>
  <committer>
    <name>Sylvain Joyeux</name>
    <email>sylvain.joyeux@m4x.org</email>
  </committer>
</commit>
