<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: How to leak a class you never defined</title>
	<atom:link href="http://tech.turbu-rpg.com/52/how-to-leak-a-class-you-never-defined/feed" rel="self" type="application/rss+xml" />
	<link>http://tech.turbu-rpg.com/52/how-to-leak-a-class-you-never-defined</link>
	<description>My thoughts on Delphi programming in general, and particularly on the technical aspects of developing the TURBU engine and editor.</description>
	<lastBuildDate>Sun, 29 Jan 2012 00:52:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Barry Kelly</title>
		<link>http://tech.turbu-rpg.com/52/how-to-leak-a-class-you-never-defined/comment-page-1#comment-28</link>
		<dc:creator>Barry Kelly</dc:creator>
		<pubDate>Thu, 29 Oct 2009 14:36:44 +0000</pubDate>
		<guid isPermaLink="false">http://tech.turbu-rpg.com/?p=52#comment-28</guid>
		<description>We&#039;ve been aware of this issue with recursive anonymous method calls since the time they were designed. The problem comes from the limits of analysis: the call to the anonymous method is through a method reference location which is actually unassigned at the time of anonymous method construction - it&#039;s only assigned after the construction has completed and the assignment occurs. After that point, if the method reference location is not modified, it will indeed leak - but that requires figuring out when, where and if a given location will be modified. How do we know it&#039;s assigned once and never reassigned or cleared by the programmer? There could be an alias (a different name for the same location, such as a pointer), or it could be assigned multiple times (such as in a loop). Follow the analysis to its logical conclusion and you have to solve the Halting problem.

At best, the compiler could give a warning that it looks like you&#039;re capturing the activation record inside the activation record itself. Or there could be some trickery done in the RTL, tracing through the object graph created by activation records, to automatically discover cycles at IInterface._Release time. Likely a runtime solution would be more robust and reliable than a compile-time one.</description>
		<content:encoded><![CDATA[<p>We&#8217;ve been aware of this issue with recursive anonymous method calls since the time they were designed. The problem comes from the limits of analysis: the call to the anonymous method is through a method reference location which is actually unassigned at the time of anonymous method construction &#8211; it&#8217;s only assigned after the construction has completed and the assignment occurs. After that point, if the method reference location is not modified, it will indeed leak &#8211; but that requires figuring out when, where and if a given location will be modified. How do we know it&#8217;s assigned once and never reassigned or cleared by the programmer? There could be an alias (a different name for the same location, such as a pointer), or it could be assigned multiple times (such as in a loop). Follow the analysis to its logical conclusion and you have to solve the Halting problem.</p>
<p>At best, the compiler could give a warning that it looks like you&#8217;re capturing the activation record inside the activation record itself. Or there could be some trickery done in the RTL, tracing through the object graph created by activation records, to automatically discover cycles at IInterface._Release time. Likely a runtime solution would be more robust and reliable than a compile-time one.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

