<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>memory-leaks &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/memory-leaks/</link>
	<description>Feed of posts on WordPress.com tagged "memory-leaks"</description>
	<pubDate>Sun, 07 Sep 2008 05:25:33 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[How to iterate all MFC objects allocated on heap?]]></title>
<link>http://weseetips.wordpress.com/?p=303</link>
<pubDate>Mon, 04 Aug 2008 16:39:58 +0000</pubDate>
<dc:creator>Jijo.Raj</dc:creator>
<guid>http://weseetips.wordpress.com/?p=303</guid>
<description><![CDATA[
MFC is famous for memory leaks. Usually we add icing and cherrys to those leaks by adding our own l]]></description>
<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-11" src="http://weseetips.wordpress.com/files/2008/03/icon_description.jpg?w=166" alt="" width="166" height="32" /><br />
<span style="color:#0000ff;">MFC is famous for memory leaks.</span> Usually <span style="color:#0000ff;">we add icing and cherrys</span> to those leaks <span style="color:#0000ff;">by adding our own leaks</span>. Is there any mechanism to track those?</p>
<p>Well, if you're object is a mfc object, <span style="color:#0000ff;">which is derived from CObject</span>, then MFC provides an iteration mechanism to iterate through your objects. You can use it to track the count of your objects in heap, you can dump selective objects... etc... etc... Well, how can you do it?</p>
<p><img class="alignnone size-medium wp-image-12" src="http://weseetips.wordpress.com/files/2008/03/icon_howcanidoit.jpg?w=220" alt="" width="220" height="32" /><br />
Use the api - <span style="color:#0000ff;">AfxDoForAllObjects()</span>. While calling <span style="color:#0000ff;">we've to pass a function pointer of expected syntax,</span> and <span style="color:#0000ff;">for each CObject derived object in heap, the function will be called</span>. See the sample to iterate all <span style="color:#0000ff;">CDynLinkLibrary </span>objects and to find its count.</p>
<pre>// This function will be called as callback
// from AfxDoForAllObjects.
void DoForAllObjects(CObject* pObject, void* pContext)
{
    // Here context is the pointer to count variable.
    int* pCount = (int*) pContext;

    // Check whether the object is of type CDynLinkLibrary
    if( dynamic_cast&#60;CDynLinkLibrary*&#62;( pObject))
    {
        // Increment count.
        ++(*pCount);
    }

}

// Iterate objects.
void CDialogDlg::Iterate()
{
    // Iterate all CObject instances and get the
    // count of instances of CDynLinkLibrary objects.
    int DynLinkLibCount = 0;
    AfxDoForAllObjects( DoForAllObjects, &#38;DynLinkLibCount );

}</pre>
<p><img class="alignnone size-medium wp-image-18" src="http://weseetips.wordpress.com/files/2008/03/icon_note.jpg?w=94" alt="" width="94" height="32" /><br />
You can utilize this for <span style="color:#0000ff;">finding memory leaks</span>, to <span style="color:#0000ff;">find the count of instances of a particular class</span>, you can <span style="color:#0000ff;">dump objects of particular class</span>, etc...</p>
<p>Well, one thing to remember - <span style="color:#0000ff;">its only available in debug build.</span> So take care! ;)</p>
<p><img class="alignnone size-medium wp-image-53" src="http://weseetips.wordpress.com/files/2008/03/intermediateseries.jpg?w=248" alt="" width="248" height="32" /><br />
Targeted Audience - Intermediate.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Out of Memory!]]></title>
<link>http://shuyingwang.wordpress.com/?p=20</link>
<pubDate>Thu, 19 Jun 2008 02:22:04 +0000</pubDate>
<dc:creator>S</dc:creator>
<guid>http://shuyingwang.wordpress.com/?p=20</guid>
<description><![CDATA[Ever since I&#8217;ve started working with MS Excel 2007, I&#8217;ve encountered several incidences ]]></description>
<content:encoded><![CDATA[<p>Ever since I've started working with MS Excel 2007, I've encountered several incidences of "out of memory" problems on a computer with 2Gig of RAM (memory). </p>
<p><a href="http://www.decisionmodels.com/memlimitsc.htm">This</a>  and <a href="http://www.mvps.org/dmcritchie/excel/slowresp.htm">this</a> point out issues on memory limits with Excel.  </p>
<p>I am doing pretty dodgy stuff like calling python scripts from VBA, among other things. Python is much, much nicer for parsing text files however...</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[How to detect Memory Leaks by using CRT?]]></title>
<link>http://weseetips.wordpress.com/?p=178</link>
<pubDate>Tue, 17 Jun 2008 18:50:28 +0000</pubDate>
<dc:creator>Jijo.Raj</dc:creator>
<guid>http://weseetips.wordpress.com/?p=178</guid>
<description><![CDATA[
 Memory leaks are every programmers nightmare. Usually we used to use memory leak detection tools s]]></description>
<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-11" src="http://weseetips.wordpress.com/files/2008/03/icon_description.jpg?w=166" alt="" width="166" height="32" /><br />
<span style="color:#0000ff;"> Memory leaks </span>are every <span style="color:#0000ff;">programmers nightmare</span>. Usually we used to use <span style="color:#0000ff;">memory leak detection tools</span> such as <span style="color:#0000ff;">Numega BoundsChecker</span>, <span style="color:#0000ff;">Rational Purify</span> to find memory leaks. But do you know that our <span style="color:#0000ff;">C Runtime library have pretty good support for isolating memory leaks?</span></p>
<p><img class="alignnone size-medium wp-image-12" src="http://weseetips.wordpress.com/files/2008/03/icon_howcanidoit.jpg?w=220" alt="" width="220" height="32" /></p>
<p>You've to enable memory leak tracking by defining constant - <span style="color:#0000ff;">_CRTDBG_MAP_ALLOC</span> and then call - <span style="color:#0000ff;">_CrtDumpMemoryLeaks()</span>. Now the leaks will be dumped to the Visual Studio output window. See the following code snippet.</p>
<pre>// Declare this in header.
#define _CRTDBG_MAP_ALLOC
#include &#60;crtdbg.h&#62;
...
void DetectLeaks()
{
    // Create some leaks.
    CString* pString = new CString;
    BYTE* pBuffer = new BYTE[100];

    // Dump memory leaks to output window.
    _CrtDumpMemoryLeaks();
}</pre>
<p>When you call <span style="color:#0000ff;">_CrtDumpMemoryLeaks()</span> the memory leak information <span style="color:#0000ff;">will be dumped to the output window</span>. For instance, see the dump for memory leaks that we've made in <span style="color:#0000ff;">DetectLeaks()</span>.</p>
<pre>Detected memory leaks!
Dumping objects -&#62;
C:\Jijo\Studies\VC++\MFC\RabbitDlg\<span style="color:#0000ff;">RabbitDlgDlg.cpp(183)</span> : {194} normal block at 0x00294990, 100 bytes long.
 Data: &#60;                &#62; CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
C:\Jijo\Studies\VC++\MFC\RabbitDlg\<span style="color:#0000ff;">RabbitDlgDlg.cpp(182)</span> : {193} normal block at 0x00293B20, 4 bytes long.
 Data: &#60;   _&#62; 14 FB 8C 5F
...
Object dump complete.</pre>
<p>The filename and line number of leak will be present in the dump. So easy, nah?</p>
<p><img class="alignnone size-medium wp-image-18" src="http://weseetips.wordpress.com/files/2008/03/icon_note.jpg?w=94" alt="" width="94" height="32" /><br />
While creating your MFC applications, did you ever noticed a code block as follows in your files?</p>
<pre>#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif</pre>
<p>This is for <span style="color:#0000ff;">debug information</span>. By using this information, the <span style="color:#0000ff;">_CrtDumpMemoryLeaks()</span> keep track of the filename. <span style="color:#0000ff;">If you comment out this, the filename will not be present in the dump</span> which will make our task difficult. So never remove those line. I swear, they are really important! ;)</p>
<p><img class="alignnone size-medium wp-image-53" src="http://weseetips.wordpress.com/files/2008/03/intermediateseries.jpg?w=248" alt="" width="248" height="32" /><br />
Targeted Audience - Intermediate</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Memory leak in beremote.exe]]></title>
<link>http://beblues.wordpress.com/?p=8</link>
<pubDate>Wed, 23 Apr 2008 22:18:03 +0000</pubDate>
<dc:creator>beblues</dc:creator>
<guid>http://beblues.wordpress.com/?p=8</guid>
<description><![CDATA[I&#8217;ve stumbled across a problem with the Backup Exec remote agent. Under a certain set of circu]]></description>
<content:encoded><![CDATA[<p>I've stumbled across a problem with the Backup Exec remote agent. Under a certain set of circumstances, the agent will consume a huge amount of virutal memory and never release it unless it is restarted.</p>
<p>This affects Backup Exec 11d rev 7170.0 with no hotfixes or service packs and with service pack 2 with all current hotfixes (as of 21st April, 2008). So, I assume all minor versions between the base and the latest are affected.</p>
<p>The problem relates to a remote server - namely a server with a remote agent that is running on a Windows 2003 R2 Server 64bit with service pack 2. Also installed on this server is Exchange Server 2007 with service pack 1. The version of the agent is 7170.0 - the latest version at the time of writing this post.</p>
<p>There's one more thing. The backup is being encrypted. When I disable the encryption the problem doesn't reoccur. So it must have something to do with that.</p>
<p>In one case I saw the process beremote.exe holding 1.5GB of virtual memory, even though there wasn't a backup running. Of course, this takes resources away from the system and services like the Exchange 2007 Information Store gets a wee bit upset about this.</p>
<p>In another example, with the same setup (Windows R2 sp2 with Ex2k7 with SP1), beremote was consuming 6.8GB of virtual memory. See image below.</p>
<p><a href="http://beblues.wordpress.com/files/2008/04/pagefile.jpg"><img class="alignnone size-full wp-image-9" src="http://beblues.wordpress.com/files/2008/04/pagefile.jpg" alt="beremote.exe eating memory like it\'s candy floss" width="460" height="714" /></a></p>
<p><a href="http://beblues.wordpress.com/files/2008/04/pagefile1.jpg"></a></p>
<p>So, what to do? Well here's a technote from Symantec: <a href="http://seer.entsupport.symantec.com/docs/289695.htm">http://seer.entsupport.symantec.com/docs/289695.htm</a></p>
<p>Here's an extract from the article:</p>
<blockquote><p><strong>Details</strong>:<br />
Each time a GRT backup of an Exchange server is performed, the memory used by the Backup Exec Remote Agent for Windows Servers ( RAWS ) process, beremote.exe, may increase. In this situation, the memory used by beremote.exe does not drop back down after backup but continues to rise with each mailbox backup performed.</p></blockquote>
<p>Note, I have other systems set up in a similar way that are not affected by this problem. The only difference is that in these cases the backups are not being encrypted.</p>
<p>Symantec don't offer a fix for this problem at the moment, just a workaround. The workaround is to restart the backup exec agent. This could be done via a scheduled task calling a batch file. Basically, the offered solution is a fudge, not a fix.</p>
<p>It is, however, very important to encrypt your backups, so turning encryption off is not the solution either - this just avoids the problem.</p>
<p>I don't know if Backup Exec v12 is affected by this issue. I've not done enough testing in this version yet.</p>
<p>Symantec Tech Support can only offer the fudge and there's no hint of a fix being released.</p>
<p>For now, the only way forward is to restart the agent when you're sure the backup process is not in use. So here's an idea, as an interim solution. Configure the backup job so that it runs a batch file that will restart the backup agent service. To do this, under Job Settings &#124; Pre/Post commands, call a batch file that restarts the remote agent on the remote server. Tip, use the 'SC.EXE' command in the batch file. Details on the command are <a title="Technet article on the SC command" href="http://technet.microsoft.com/en-gb/library/bb490995.aspx" target="_blank">here</a>. Here's an example of the command in full:</p>
<p>sc <a href="//\\REMOTE_SERV">\\REMOTE_SERV</a> stop BackupExecAgentAccelerator &#38; timeout /T 30 &#38;&#38; sc <a href="//\\REMOTE_SERV">\\REMOTE_SERV</a> start BackupExecAgentAccelerator</p>
<p>(there's no carriage return within the command, only at the end)</p>
<p>In the example above, change 'REMOTE_SERV' with the name of your remote server that is affected by this problem. Note, the '/T 30' part of the command relates to the timeout required between sending the stop command and sending the start command. 30 seconds seems to work okay for me. You may want to increase this timeout if the service doesn't start (because it hasn't yet finished the stop command).</p>
<p>Hope this helps. Let me know if you've come across this problem.</p>
<p><strong>BEBlue</strong></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[¿Cuanta memoria usa tu navegador?]]></title>
<link>http://javieraroche.com/2007/11/28/cuanta-memoria-usa-tu-navegador/</link>
<pubDate>Wed, 28 Nov 2007 23:37:08 +0000</pubDate>
<dc:creator>Javier Aroche</dc:creator>
<guid>http://javieraroche.com/2007/11/28/cuanta-memoria-usa-tu-navegador/</guid>
<description><![CDATA[Generalmente uso varios navegadores, más por motivos del trabajo, uso Firefox, IE 6 y 7, Epiphany y]]></description>
<content:encoded><![CDATA[<p>Generalmente uso varios navegadores, más por motivos del trabajo, uso Firefox, IE 6 y 7, Epiphany y últimamente <a href="http://javieraroche.com/2007/06/14/safari-en-windows-una-estafa/">el ya no tan malo</a> Safari. Hoy casi todo el día he usado Firefox y ha estas horas está que ya no da una, el consumo de memoria marca:</p>
<p style="text-align:center;"><img src="http://aroche.net/shared/imgs/screenshots/firefox-memory.png" alt="Consumo de memoria" /></p>
<p>Creo que tengo unas 15 tabs abiertas, y un historial bastante grande de navegación en el día. Condenado firefox, hasta ya cuesta que cambie de pestaña. </p>
<p>¿Y a ustedes, qué tanta memoria les consume memoria el navegador?</p>
<p class="tags"><strong>Etiquetas</strong>: <a href="http://javieraroche.com/category/firefox/">firefox</a>, <a href="http://javieraroche.com/category/it/hardware-software/">software</a>, <a href="http://javieraroche.com/tag/memory-leaks/">memory leaks</a>, <a href="http://javieraroche.com/category/navegadores/">navegadores</a>, <a href="http://javieraroche.com/tag/sucks/">sucks</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Memory leaks, Firefox, Flock and Opera]]></title>
<link>http://imaverick.wordpress.com/2007/11/25/memory-leaks-firefox-flock-and-opera/</link>
<pubDate>Sun, 25 Nov 2007 00:36:24 +0000</pubDate>
<dc:creator>imaverick</dc:creator>
<guid>http://imaverick.wordpress.com/2007/11/25/memory-leaks-firefox-flock-and-opera/</guid>
<description><![CDATA[Moving from IE to Firefox
*Update: This is a old post that i wrote when Firefox 3 was still in early]]></description>
<content:encoded><![CDATA[<p><span style="font-weight:bold;">Moving from IE to Firefox</span></p>
<p>*Update: This is a old post that i wrote when Firefox 3 was still in early days of development and before the performance improvements were done.*</p>
<p>I switched from IE to <a href="http://www.mozilla.com/en-US/firefox/">Firefox </a>1.5 because of its amazing features like tabs, better session saver, add-ons and most of all its developer friendly tools like <a href="https://addons.mozilla.org/en-US/firefox/addon/1843">FireBug</a> which to me came as a breather for web-development. And needless to say i never missed <a href="http://www.microsoft.com/windows/products/winfamily/ie/default.mspx">IE</a>.</p>
<p>But then, as i became addicted to the tabbed browsing, like many others even i cultivated a bad habit of opening the links that i would like to read and come back later when i had time. so usually i had i atleast 15-20 tabs in each window and atleast 2-3 windows open. see it was just convenience...!!</p>
<p><span style="font-weight:bold;">Memory leaks in Firefox and moving onto Opera</span></p>
<p>But because of my bad habit of having so many tabs open, the memory hogging in <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> was *ahem* unbearable...and lo...to add to that it also started crashing...and at times i<br />
would restart the <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> manually when the memory usage was very high and i was hoping that this would be fixed in the future versions, but nothing much happened on those lines and i was looking for some alternative, and then i tried <a href="http://www.opera.com/">Opera </a>(without the ads ;) and it had all the features that i wanted except for the <a href="https://addons.mozilla.org/en-US/firefox/addon/1843">FireBug</a>. But hey..that was okay..when i had to test my sites, i would go to <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a>, but for normal web-browsing, i never missed <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a>, just the way i never missed IE when i switched to <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a>. <a href="http://www.opera.com/">Opera</a> was just <span style="font-weight:bold;">freakin...awesome..!!! </span>and i loved it for the memory footprint that it occupied and it never crashed for me (though, YMMV ;) and to add to that, <a href="http://www.opera.com/">Opera</a> had lot more features like integrated mail client, newsgroups, saving multiple sessions, needless to say i loved it ;)</p>
<p><strong><a href="http://www.flock.com/">Flock</a></strong></p>
<p>So when i came across the <a href="http://www.techcrunch.com/2007/10/19/flock-10-beta-released-surprisingly-very-good/">beta release of flock</a>, i was just curious to try it out and my first thoughts were, oh its a <span style="font-weight:bold;">replica of </span><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> with few more functionalities, primary among those being a integrated access to various social networking sites from its sidebar. well..which was not bad..*ahem* quite good, just like you don't want to open different mail clients for each and every mail account that you have, you would like to have an integrated access to all these social networking sites instead of logging into each one of them. so this integration was quite a welcome feature given the fad for social networking sites. But, hey...is that reason enough for altogether a new browser..? i don't think so..but to be fair, Flock also has other features like Web Clipboard, Blogging client, Media bar, and obviously the sidebar.</p>
<p>But another interesting point that i came across was regarding the <a href="http://www.techcrunch.com/2007/11/20/firefox-3-beta-1-the-memory-use-says-it-all/">memory usage comparison </a>of <strong><a href="http://www.flock.com/">Flock</a></strong> vs <a href="http://wiki.mozilla.org/Firefox3">firefox 3.0</a>. well just to double check on this, i fired up all my tabs in <a href="http://www.opera.com/">Opera</a> in <a href="http://www.flock.com/">Flock</a> and also in <a href="http://wiki.mozilla.org/Firefox3">firefox 3.0</a> and boy <a href="http://www.opera.com/">Opera</a> beats them all and <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> crashes as usual :), but though, <a href="http://www.flock.com/">Flock</a> initially used more memory footprint than <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a>, it never crashed :), which was interesting and i'm just curious what tweaks did <strong><a href="http://www.flock.com/">Flock</a></strong><span style="font-weight:bold;"> guys</span> do to the <a href="http://www.mozilla.com/en-US/firefox/">Firefox</a> engine and why is firefox still not fixing it? i see that <a href="http://wiki.mozilla.org/Firefox3">firefox 3.0</a> has loads of <a href="http://wiki.mozilla.org/Firefox3/Product_Requirements_Document">features</a> but why are they not fixing this serios issue of frequent crashes..? what will we do with those features when the browser would crash anyway..? well in that sense , kudos to <a href="http://www.flock.com/">Flock</a> and i hope to see how flock catches up with the new versions of the <a href="http://wiki.mozilla.org/Firefox3">firefox 3.0</a> engine. And if they do manage to catch up, then i wouldn't see why people who wants to move to <a href="http://wiki.mozilla.org/Firefox3">firefox 3.0</a> should not move to <a href="http://www.flock.com/">Flock</a> if not my fav browser <a href="http://www.opera.com/">Opera</a> :)</p>
<p>But hey..i am <span style="font-weight:bold;">not</span> going to switch my loyalty from<strong> </strong><strong><a href="http://www.opera.com/">Opera</a></strong><strong> </strong>to <strong><a href="http://www.flock.com/">this new browser</a></strong> for just the side-bar ;) <strong> </strong></p>
<p><strong><a href="http://www.opera.com/">Opera</a></strong><strong> ROCKS!!!</strong></p>
<p style="font-size:10px;text-align:right;"><a rel="tag" href="http://technorati.com/tag/%20opera"><br />
</a></p>
<p><!-- technorati tags end --></p>
]]></content:encoded>
</item>

</channel>
</rss>
