<?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"
	>
<channel>
	<title>Comments on: Why Has the Size of TObject Doubled In Delphi 2009?</title>
	<atom:link href="http://blogs.teamb.com/craigstuntz/2009/03/25/38138/feed/" rel="self" type="application/rss+xml" />
	<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/</link>
	<description>C# • Delphi • Entity Framework • Functional Programming • InterBase • MVC • .NET • Web</description>
	<pubDate>Thu, 11 Mar 2010 13:33:35 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Mason Wheeler</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4966</link>
		<dc:creator>Mason Wheeler</dc:creator>
		<pubDate>Thu, 26 Mar 2009 19:42:31 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4966</guid>
		<description>Patrick:

Take a look at Steven Kamradt's idea a few posts up.  If CodeGear does something like this, there shouldn't ever have to be a "next time".  I hope.</description>
		<content:encoded><![CDATA[<p>Patrick:</p>
<p>Take a look at Steven Kamradt&#8217;s idea a few posts up.  If CodeGear does something like this, there shouldn&#8217;t ever have to be a "next time".  I hope.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick van Logchem</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4965</link>
		<dc:creator>Patrick van Logchem</dc:creator>
		<pubDate>Thu, 26 Mar 2009 18:15:31 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4965</guid>
		<description>Yeah, 4 bytes is not much, especially in relation to already-large instances. And I do agree on all your points.

But still, the virtual-memory limit on win32 will now be reached sooner than before (even more so now that string has become UTF16 encoded). Not many applications will notice this, sure. But some will. That's why I would have expected that a change like this had been communicated more clearly.
Also, I don't see why this was actually released together with Tiburon. There's no documentation or mention of the new TMonitor functionality either (unless I've somehow missed this?)

And on top of all that, there's no feasible way to get back the original InstanceSize!

I already discussed some options with Hallvard Vassbotn, like patching TObject.GetInstanceSize (which won't work, as that's marked 'inline' now) or patching TObject.NewInstance (which could work - allocation-wise, but would still report the wrong InstanceSize). In any case, we would have to nullify TMonitor.DestroyObject (or what's-it's-name). Last resort would be to detect all classes early in the initialization phase, and decrease all vmtInstanceSize values by 4. None of this is a 'clean' 'fix', so it would have been nicer if this increase was either left out, or was done via a project-option or some such.

For now, I guess most people will probably accept this without much objections. (I suspect I too won't even bother patching this.) But I do hope that next time (if you can speak of a 'next time' for things like this) we'd be informed beforehand, and where offered a choice. (Actually, the Unicode-move is a great example, as we can still use AnsiString if we wish to do so).</description>
		<content:encoded><![CDATA[<p>Yeah, 4 bytes is not much, especially in relation to already-large instances. And I do agree on all your points.</p>
<p>But still, the virtual-memory limit on win32 will now be reached sooner than before (even more so now that string has become UTF16 encoded). Not many applications will notice this, sure. But some will. That&#8217;s why I would have expected that a change like this had been communicated more clearly.<br />
Also, I don&#8217;t see why this was actually released together with Tiburon. There&#8217;s no documentation or mention of the new TMonitor functionality either (unless I&#8217;ve somehow missed this?)</p>
<p>And on top of all that, there&#8217;s no feasible way to get back the original InstanceSize!</p>
<p>I already discussed some options with Hallvard Vassbotn, like patching TObject.GetInstanceSize (which won&#8217;t work, as that&#8217;s marked &#8216;inline&#8217; now) or patching TObject.NewInstance (which could work - allocation-wise, but would still report the wrong InstanceSize). In any case, we would have to nullify TMonitor.DestroyObject (or what&#8217;s-it&#8217;s-name). Last resort would be to detect all classes early in the initialization phase, and decrease all vmtInstanceSize values by 4. None of this is a &#8216;clean&#8217; &#8216;fix&#8217;, so it would have been nicer if this increase was either left out, or was done via a project-option or some such.</p>
<p>For now, I guess most people will probably accept this without much objections. (I suspect I too won&#8217;t even bother patching this.) But I do hope that next time (if you can speak of a &#8216;next time&#8217; for things like this) we&#8217;d be informed beforehand, and where offered a choice. (Actually, the Unicode-move is a great example, as we can still use AnsiString if we wish to do so).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4961</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Thu, 26 Mar 2009 10:57:18 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4961</guid>
		<description>Patrick, I don't think the extra four bytes is a big deal. If you are allocating "hundreds of millions of instances," then that, rather than the size of TObject, is your memory issue. Remember, you don't generally allocate TObject; instead, you allocate TSomething, which is probably one or two orders of magnitude larger. The extra four bytes is tiny next to the size of any actual instance of some concrete type. An object pool is indeed a reasonable way to address this issue. There are other ways, too.

No, I have not noticed a lot of people complaining about this. Indeed, few people seem to have even noticed. It is certainly small next to the increase in size of string instances to support Unicode.

But the basic facts about the desktop computing market today are:

1. Hyper-threading, multicore, and multi-CPU are the rule, not the exception.
2. Unicode is the rule, not the exception (e.g., the web and Windows are both Unicode at the core) 
3. Memory is cheaper than it has ever been, and it keeps getting cheaper (at least, if you're not so unfortunate as to own a machine with Rambus memory...)</description>
		<content:encoded><![CDATA[<p>Patrick, I don&#8217;t think the extra four bytes is a big deal. If you are allocating "hundreds of millions of instances," then that, rather than the size of TObject, is your memory issue. Remember, you don&#8217;t generally allocate TObject; instead, you allocate TSomething, which is probably one or two orders of magnitude larger. The extra four bytes is tiny next to the size of any actual instance of some concrete type. An object pool is indeed a reasonable way to address this issue. There are other ways, too.</p>
<p>No, I have not noticed a lot of people complaining about this. Indeed, few people seem to have even noticed. It is certainly small next to the increase in size of string instances to support Unicode.</p>
<p>But the basic facts about the desktop computing market today are:</p>
<p>1. Hyper-threading, multicore, and multi-CPU are the rule, not the exception.<br />
2. Unicode is the rule, not the exception (e.g., the web and Windows are both Unicode at the core)<br />
3. Memory is cheaper than it has ever been, and it keeps getting cheaper (at least, if you&#8217;re not so unfortunate as to own a machine with Rambus memory&#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Patrick van Logchem</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4958</link>
		<dc:creator>Patrick van Logchem</dc:creator>
		<pubDate>Thu, 26 Mar 2009 05:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4958</guid>
		<description>Just for the record, it was Thorsten Engler who mentioned this extension first (he wrote about this already on july 22, 2008).

I didn't realize it at that time, but it never occurred to me Allan's TMonitor experiments where meant to be actually released with Delphi 2009. Only nowI discover InstanceSize changed to 8 bytes  (thanks Mason), without a mention anywhere (or was it?)!

Am I the only one getting freaked out about this?!

Our application allocates literally hundreds of millions of instances... if it wasn't for our own instance-pool (which works with fixed instance sizes), this would have meant a killing increase in memory-usage!
Surely others must get EOutOfMemory too now that they start releasing Delphi 2009 builds of there software?!?

I wish this was communicated more openly, and a fallback to the original InstanceSize was kept possible (because seriously, how many of you are already using the new TMonitor design?)</description>
		<content:encoded><![CDATA[<p>Just for the record, it was Thorsten Engler who mentioned this extension first (he wrote about this already on july 22, 2008).</p>
<p>I didn&#8217;t realize it at that time, but it never occurred to me Allan&#8217;s TMonitor experiments where meant to be actually released with Delphi 2009. Only nowI discover InstanceSize changed to 8 bytes  (thanks Mason), without a mention anywhere (or was it?)!</p>
<p>Am I the only one getting freaked out about this?!</p>
<p>Our application allocates literally hundreds of millions of instances&#8230; if it wasn&#8217;t for our own instance-pool (which works with fixed instance sizes), this would have meant a killing increase in memory-usage!<br />
Surely others must get EOutOfMemory too now that they start releasing Delphi 2009 builds of there software?!?</p>
<p>I wish this was communicated more openly, and a fallback to the original InstanceSize was kept possible (because seriously, how many of you are already using the new TMonitor design?)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mason Wheeler</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4947</link>
		<dc:creator>Mason Wheeler</dc:creator>
		<pubDate>Wed, 25 Mar 2009 17:01:50 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4947</guid>
		<description>Yeah.  I was at a Delphi Users' Group meeting about 3 weeks ago, where Anders Ohlsson said it would be out "any day now."

Oh well.  If they're going to delay things, I really hope they can find time to include fixes for QC #s 72070 and 71837 in there.  Bad VCL code or strange generics quirks that don't always compile right are bad enough, but when the compiler silently creates a bad binary, that's a critical error IMO.</description>
		<content:encoded><![CDATA[<p>Yeah.  I was at a Delphi Users&#8217; Group meeting about 3 weeks ago, where Anders Ohlsson said it would be out "any day now."</p>
<p>Oh well.  If they&#8217;re going to delay things, I really hope they can find time to include fixes for QC #s 72070 and 71837 in there.  Bad VCL code or strange generics quirks that don&#8217;t always compile right are bad enough, but when the compiler silently creates a bad binary, that&#8217;s a critical error IMO.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4946</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Wed, 25 Mar 2009 16:56:54 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4946</guid>
		<description>Mason, I seem to recall that there will be TDictionary fixes in the forthcoming update 3, which has apparently been ready to go for some time and is held up by what Nick mysteriously described as non-technical reasons.</description>
		<content:encoded><![CDATA[<p>Mason, I seem to recall that there will be TDictionary fixes in the forthcoming update 3, which has apparently been ready to go for some time and is held up by what Nick mysteriously described as non-technical reasons.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mason Wheeler</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4945</link>
		<dc:creator>Mason Wheeler</dc:creator>
		<pubDate>Wed, 25 Mar 2009 16:45:22 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4945</guid>
		<description>*laughs* TDictionary is &lt;i&gt;so&lt;/i&gt; broken.  I agree; I'd like to see it fixed RSN.

Thanks for the link, Craig.  I just hope I don't get a bunch of people wandering in, glancing around for a second, saying "hey, this isn't a programming blog!" and then leaving again. :P</description>
		<content:encoded><![CDATA[<p>*laughs* TDictionary is <i>so</i> broken.  I agree; I&#8217;d like to see it fixed RSN.</p>
<p>Thanks for the link, Craig.  I just hope I don&#8217;t get a bunch of people wandering in, glancing around for a second, saying "hey, this isn&#8217;t a programming blog!" and then leaving again. <img src='http://blogs.teamb.com/craigstuntz/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Kamradt</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4944</link>
		<dc:creator>Steven Kamradt</dc:creator>
		<pubDate>Wed, 25 Mar 2009 16:43:36 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4944</guid>
		<description>and that was tDictionary&#60;TObject,TMetaDataRec&#62; but I forgot I was commenting in HTML.  :)</description>
		<content:encoded><![CDATA[<p>and that was tDictionary&lt;TObject,TMetaDataRec&gt; but I forgot I was commenting in HTML.  <img src='http://blogs.teamb.com/craigstuntz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Kamradt</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4943</link>
		<dc:creator>Steven Kamradt</dc:creator>
		<pubDate>Wed, 25 Mar 2009 16:41:57 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4943</guid>
		<description>Ah, so its back to using a tDictionary to store the metadata then... at least as long as one doesn't for..each in another unit (hoping the next patch fixes that issue)</description>
		<content:encoded><![CDATA[<p>Ah, so its back to using a tDictionary to store the metadata then&#8230; at least as long as one doesn&#8217;t for..each in another unit (hoping the next patch fixes that issue)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Craig Stuntz</title>
		<link>http://blogs.teamb.com/craigstuntz/2009/03/25/38138/#comment-4942</link>
		<dc:creator>Craig Stuntz</dc:creator>
		<pubDate>Wed, 25 Mar 2009 16:34:06 +0000</pubDate>
		<guid isPermaLink="false">http://blogs.teamb.com/craigstuntz/?p=38138#comment-4942</guid>
		<description>Steven, no, that isn't quite right. First of all, the ability to add metadata to an object instance that Allen referred to is &lt;em&gt;today&lt;/em&gt; the ability of the CodeGear/Embarcadero team to add metadata of a specific size which is hard coded into the source code of TObject. Mere mortals like you and I cannot enhance this unless we recompile the RTL. Second, the link itself is not TMonitor. In the example I describe in this post, TMonitor is the payload, not the link. The link is an untyped pointer.

The feature you describe would be convenient, although I haven't thought through what the downsides might be. One significant downside is that it is not in the product today. :) Allen seemed to imply that such a feature could happen in the future, though.</description>
		<content:encoded><![CDATA[<p>Steven, no, that isn&#8217;t quite right. First of all, the ability to add metadata to an object instance that Allen referred to is <em>today</em> the ability of the CodeGear/Embarcadero team to add metadata of a specific size which is hard coded into the source code of TObject. Mere mortals like you and I cannot enhance this unless we recompile the RTL. Second, the link itself is not TMonitor. In the example I describe in this post, TMonitor is the payload, not the link. The link is an untyped pointer.</p>
<p>The feature you describe would be convenient, although I haven&#8217;t thought through what the downsides might be. One significant downside is that it is not in the product today. <img src='http://blogs.teamb.com/craigstuntz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> Allen seemed to imply that such a feature could happen in the future, though.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
