title: Why does registering to event with empty lambda function cause strong reference in memory?
body: <p>There is some sample code:</p>
  
  <pre><code>public class Publisher
      event Published()
  end class
  
  public class Subscriber
      public sub new(Publisher as Publisher)
          addhandler Publisher.Published,
              sub()
  
              end sub
      end sub
  end class
  </code></pre>
  
  <ol>
  <li><p>Does registering to the <code>Publisher</code> event in <code>Subscriber</code> constructor prevent <code>Subscriber</code> from being garbage collected even if an empty lambda function, that doesn't capture <code>Subscriber</code>, is passed as event handler?</p></li>
  <li><p>Is it the same in C#?</p></li>
  </ol>
  
  <p><strong>Edit</strong></p>
  
  <p>A simple console application to test it:</p>
  
  <pre><code>Sub Main()
  
      Dim Publisher As New Publisher
  
      For i = 1 To 1000000
          Dim Subscriber As New Subscriber(Publisher)
      Next
  
      GC.Collect()
      Dim TotalMemory = GC.GetTotalMemory(True)
  
      Trace.WriteLine(TotalMemory)
  End Sub
  </code></pre>
  
  <p>Unfortunately, <em>the application consumes 36 megabytes of memory after garbage collection</em>, which means that <em>all Subscribers stay in memory</em>! </p>
  
  <p>Debug and Release on different target frameworks 2.0, 3.0, 3.5, 4.0, 4.5 give the same results.</p>
  
  <ol start="3">
  <li>Can anyone reproduce the issue or explain why adding an event handler works with way?</li>
  </ol>