<?xml version="1.0" encoding="UTF-8"?> <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/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>Scott Gruby&#039;s Blog &#187; Work</title> <atom:link href="http://blog.gruby.com/tag/work/feed/" rel="self" type="application/rss+xml" /><link>http://blog.gruby.com</link> <description>Another semi-useless spot on the web...</description> <lastBuildDate>Fri, 23 Dec 2011 05:23:22 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>Working smarter, not harder</title><link>http://blog.gruby.com/2009/05/15/working-smarter-not-harder/</link> <comments>http://blog.gruby.com/2009/05/15/working-smarter-not-harder/#comments</comments> <pubDate>Sat, 16 May 2009 03:33:33 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Main]]></category> <category><![CDATA[Personal]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/?p=2150</guid> <description><![CDATA[Work has been the focus of my life for a long time, especially the 5.5 years prior to my new job. Being a self-employed contractor meant that every hour I worked, I got paid. Then when I started ReceiptWallet, I &#8230; <a href="http://blog.gruby.com/2009/05/15/working-smarter-not-harder/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Work has been the focus of my life for a long time, especially the 5.5 years prior to my new job. Being a self-employed contractor meant that every hour I worked, I got paid. Then when I started ReceiptWallet, I had to not only do my contract work, I had to handle support and development of ReceiptWallet which took up more time.</p><p>Last summer I started to re-evaluate my life and started my path towards working less and working smarter. Taking a full time job was my first step. Deciding to sell ReceiptWallet was my next step. Now that my work consists of one day job, it&#8217;s time for me to clean up my act and make better use of my time both during the day and after work. A friend of mine sent me a link to a Merlin Mann <a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?i=49665310&#038;id=83025342">podcast</a> about blocking off time and &#8220;ganging&#8221; requests that people make of me. While the podcast may offend some with the language that Merlin uses, it is definitely worth a listen. Most of my work day is spent in a reactionary fashion; instant messaging is part of work and reacting to issues is another part. Luckily, in the last six months, my IT team and I have been able to turn the constant fires into something that is a lot less frequent. However, I still am finding that I need to carve out time to focus on the harder projects. I need to take the incoming requests, log them and get to them later. Ever since I wrote NotifyMail, I&#8217;ve interrupt driven. (Curse email&#8230;I got addicted way too long ago!)</p><p>Most of the people I work with are in the central time zone, so around 3 pm my time, the interruptions pretty much stop. I&#8217;m going to try to use the time from 3 to 5 pm as a daily time to focus on the bigger projects that take a lot more concentration. The smaller projects, I can do during the day as they don&#8217;t take as much concentration. I&#8217;m hoping that I can really stick to this. Already I&#8217;ve met my goal of working less (my boss probably doesn&#8217;t want to hear that <img src='http://blog.gruby.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> ), so I think it is achievable. While I have handled as much work that has been thrown at me in the past, I&#8217;m in a different position juggling more. The key to thriving, in my opinion, is to work much smarter and work less. Some people can work all the time, but I found that I&#8217;m not really effective after 5-6 pm in terms of my heavy thinking. Believe it or not, I never pulled an all-nighter in college; the closest I came was staying up to 3 or so working on the school paper, but that was monkey work doing page layout.</p><p>I&#8217;m crossing my fingers that the changes in my life in the past year will help make me a more balanced person. Next up, finding a hobby and actually doing it! LEGO building is fun, but I&#8217;m looking for something challenging as well. We&#8217;ll see.</p><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2009/05/15/working-smarter-not-harder/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>New job</title><link>http://blog.gruby.com/2009/05/11/new-job/</link> <comments>http://blog.gruby.com/2009/05/11/new-job/#comments</comments> <pubDate>Tue, 12 May 2009 03:56:53 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Main]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/?p=2139</guid> <description><![CDATA[As some of you that follow my blog have inferred from my posts, I have a new job. I started with alwaysBEthere, Inc. as Director of Technology. alwaysBEthere was a client of mine for several years, and I was offered &#8230; <a href="http://blog.gruby.com/2009/05/11/new-job/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>As some of you that follow my blog have inferred from my posts, I have a new job. I started with <a href="http://www.alwaysbethere.com/">alwaysBEthere, Inc.</a> as Director of Technology. alwaysBEthere was a client of mine for several years, and I was offered a full time job. Switching from a contractor (I was a contractor for over 5 1/2 years) to an employee again wasn&#8217;t that hard for me. As part of joining the company, I made it a requirement that I be able to work for home, so that part didn&#8217;t change. The company is headquartered in Minneapolis with a small office here in San Diego. So while I have the option of going into our office, I only do it now and again; I find that I can get much more work done at home without having to commute.</p><p>So what do I do? I don&#8217;t have much of a clue on a day to day basis! I handle all kinds of requests ranging from our internal IT to working on projects that could affects customers. Now that I&#8217;m six months into it, I feel like I&#8217;m finally getting a handle on part of my job.</p><p>What will the next six months bring? I don&#8217;t know. Do I have any regrets about not being self employed anymore? Not really. I didn&#8217;t become self-employed out of choice, but out of necessity (the last company I was with didn&#8217;t have any work for me and frankly, I was bored, so we parted on good terms). I stayed a contractor because I was doing well and didn&#8217;t think I could find a job with as much flexibility as I had. I like what I&#8217;m doing and it presents much different challenges from when I was self-employed. As long as I&#8217;m challenged and feel like I&#8217;m accomplishing something, I think I&#8217;ll be happy.</p><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2009/05/11/new-job/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Aging Hardware</title><link>http://blog.gruby.com/2006/02/14/aging-hardware/</link> <comments>http://blog.gruby.com/2006/02/14/aging-hardware/#comments</comments> <pubDate>Tue, 14 Feb 2006 22:42:26 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Technology]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/2006/02/14/aging-hardware/</guid> <description><![CDATA[Every now and again, I tend to look at the equipment I have on my desk and think about how long I&#8217;ve had it. The oldest piece of &#8220;equipment&#8221; is a pair of Apple Design speakers that I got in &#8230; <a href="http://blog.gruby.com/2006/02/14/aging-hardware/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Every now and again, I tend to look at the equipment I have on my desk and think about how long I&#8217;ve had it. The oldest piece of &#8220;equipment&#8221; is a pair of Apple Design speakers that I got in 1996 or 1997. They still are in use and work quite well. The second most ancient piece of equipment is my PowerMac G4/500 dual processor which I bought in late summer 2000. This machine, despite being 5.5 years old, still serves as my test and build machine. My builds now take 20-25 minutes as there are a ton of components and I keep considering if I should upgrade to a newer machine. I&#8217;ll still need a PowerPC based machine for testing, so maybe I&#8217;ll be able to pick up a G5 dual processor machine cheap as soon as the Intel based towers come out.<br /><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2006/02/14/aging-hardware/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Sample code is great (when it works)</title><link>http://blog.gruby.com/2006/02/10/sample-code-is-great-when-it-works/</link> <comments>http://blog.gruby.com/2006/02/10/sample-code-is-great-when-it-works/#comments</comments> <pubDate>Sat, 11 Feb 2006 03:09:20 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/2006/02/10/sample-code-is-great-when-it-works/</guid> <description><![CDATA[I think that it&#8217;s great that companies like Apple put out sample code to help developers write code without having to resort to figuring it out themselves or doing something in a way that will break. Several years ago I &#8230; <a href="http://blog.gruby.com/2006/02/10/sample-code-is-great-when-it-works/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I think that it&#8217;s great that companies like Apple put out sample code to help developers write code without having to resort to figuring it out themselves or doing something in a way that will break. Several years ago I wanted to add my application (NotifyMail) to the login items/startup items for a user under OS X when OS X was new. There was no documented way to do this, but a DTS engineer at Apple posted on a mailing list that if people wanted code, to send him email. So I sent him email and have been using the code ever since in a bunch of projects. It had a major limitation in that if System Preferences was open and you used the code to modify login items, the user wouldn&#8217;t see the change which could be confusing. I had added an awkwardly worded alert indicating this and no one complained.</p><p>As I was changing some setup stuff on one of my machines, I added an item to the login items by using the contextual menu item in the dock. I then opened up system preferences and began adding and removing it via the menu again. To my surprise (and delight) system preferences immediately indicated the change. After a bit of searching, I found some sample code called <a href="http://developer.apple.com/samplecode/LoginItemsAE/LoginItemsAE.html">LoginItemsAE</a> which was first created last October. I download the code, added it to my project and attempted to compile. Hmmm&#8230;it relied on stuff in Mac OS X 10.4, but I was targeting 10.3 (and 10.4.), so it didn&#8217;t compile. I double checked the sample code and it says it goes back to 10.2. After a lot of research, it turns out that in order to get the code to compile, even if targeting 10.3, I had to set the SDK to the 10.4 SDK. I didn&#8217;t want to do this as I have 50+ targets in one project that all use one configuration file that sets the SDK to 10.3.9; this kind of change could be bad as it would allow me to use functions only found in newer OS versions and then crash on older systems. So if I&#8217;m not careful, I&#8217;ll get a crash. By setting the SDK, if it doesn&#8217;t compile, it won&#8217;t run on the older OS version which makes life easier. It would be nice if there was a way to warn you about which functions aren&#8217;t available on newer OS versions.</p><p>To make a long story a little shorter, I had to whip up some stub code to get it to compile which was a whole lot more work than I had expected.<br /><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2006/02/10/sample-code-is-great-when-it-works/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Tracking down bugs</title><link>http://blog.gruby.com/2006/02/07/tracking-down-bugs/</link> <comments>http://blog.gruby.com/2006/02/07/tracking-down-bugs/#comments</comments> <pubDate>Wed, 08 Feb 2006 05:28:29 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/2006/02/07/tracking-down-bugs/</guid> <description><![CDATA[One of the hardest aspects of writing code is debugging it when it doesn&#8217;t want what you expect. In one of my past jobs, I was given the task of making a server stable which meant finding a bug buried &#8230; <a href="http://blog.gruby.com/2006/02/07/tracking-down-bugs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>One of the hardest aspects of writing code is debugging it when it doesn&#8217;t want what you expect. In one of my past jobs, I was given the task of making a server stable which meant finding a bug buried in thousands of lines of code that I really didn&#8217;t understand. No one gave me a timetable on doing this, so I worked at it for over 4 months if I recall correctly. Turns out the problem was a bug in a driver that we didn&#8217;t even control; I put in a workaround and moved on.</p><p>Today I spent over 4 hours working with an excellent QA engineer to track down a bug; he did everything I asked him to do, sent me logs, reinstalled software, tried on a second machine, etc. Turns out that if I had read the log a little closer, I would have been able to fix the bug in minutes instead of hours. Having a QA resource like this makes it so much easier to find stupid bugs.<br /><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2006/02/07/tracking-down-bugs/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Reliable Internet Access</title><link>http://blog.gruby.com/2006/02/05/reliable-internet-access/</link> <comments>http://blog.gruby.com/2006/02/05/reliable-internet-access/#comments</comments> <pubDate>Sun, 05 Feb 2006 10:43:18 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Technology]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/2006/02/05/reliable-internet-access/</guid> <description><![CDATA[It seems that people I work with have Internet problems a whole lot more often than I. I feel quite lucky that my cable modem provider, Time Warner Cable, has been pretty rock solid for the last 6+ years that &#8230; <a href="http://blog.gruby.com/2006/02/05/reliable-internet-access/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>It seems that people I work with have Internet problems a whole lot more often than I. I feel quite lucky that my cable modem provider, Time Warner Cable, has been pretty rock solid for the last 6+ years that I&#8217;ve had them. There have been a few issues in that time, but nothing that I can really remember. I did have a problem with their DNS servers that drove me crazy, so I started running my own. I handle my own email, so I don&#8217;t have to worry about that either. The &#8220;pipe&#8221; that Time Warner provides is fast and reliable. What more can I ask for in a provider?<br /><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2006/02/05/reliable-internet-access/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>The Joys of Working at home and being self employed</title><link>http://blog.gruby.com/2006/02/02/the-joys-of-working-at-home-and-being-self-employed/</link> <comments>http://blog.gruby.com/2006/02/02/the-joys-of-working-at-home-and-being-self-employed/#comments</comments> <pubDate>Thu, 02 Feb 2006 19:00:50 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Personal]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/2006/02/02/the-joys-of-working-at-home-and-being-self-employed/</guid> <description><![CDATA[I&#8217;ve been working at home for about 6.5 years and have been self employed for almost 3. When I tell people I work at home, they usually respond that it must be nice. Well, it takes a certain kind of &#8230; <a href="http://blog.gruby.com/2006/02/02/the-joys-of-working-at-home-and-being-self-employed/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I&#8217;ve been working at home for about 6.5 years and have been self employed for almost 3. When I tell people I work at home, they usually respond that it must be nice. Well, it takes a certain kind of person and attitude to work at home. My first experience working at home was when I lived in Portland, OR and the company I worked for had basically shut its doors, but kept me on board for a few months. As I was relatively new to Portland and the weather was just awful (it was in the winter) I absolutely hated the experience. After I left Portland and moved back to San Diego, I chose to work at home, while still working for a company in Portland. Since it was now my choice to work at home, things were much better. Working at home gives me the flexibility to goto the gym when I want, run errands when I want, and work when I want. With all this flexibility comes a few downsides. The biggest being that I can work all the time; now that I&#8217;m self employed, the more I work, the more I get paid, so it sort of makes me want to work more. Some days I like working at home, occasionally the silence and lack of interaction gets to me.</p><p>As for being self employed&#8230;I&#8217;m not sure that I could work for anyone again. The ability to take off when I want without permission is great. The tax breaks are definitely worth being self employed. The big downsides are that if I don&#8217;t work, I don&#8217;t get paid which causes me to work a lot more than if I had an employer and if I&#8217;m sick, I don&#8217;t work and don&#8217;t get paid. This, of course, can lead to a lot of stress.</p><p>Overall, being self employed and working at home agrees with me.<br /><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2006/02/02/the-joys-of-working-at-home-and-being-self-employed/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Hard Drive Recovery complete</title><link>http://blog.gruby.com/2006/01/30/hard-drive-recovery-complete/</link> <comments>http://blog.gruby.com/2006/01/30/hard-drive-recovery-complete/#comments</comments> <pubDate>Mon, 30 Jan 2006 19:34:19 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Technology]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/2006/01/30/hard-drive-recovery-complete/</guid> <description><![CDATA[I restored my PowerBook&#8217;s hard drive to the state it was on Saturday before it crashed using the most excellent SuperDuper!. If you aren&#8217;t doing regular backups (daily), then you are asking for trouble. There are 2 kinds of computer &#8230; <a href="http://blog.gruby.com/2006/01/30/hard-drive-recovery-complete/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>I restored my PowerBook&#8217;s hard drive to the state it was on Saturday before it crashed using the most excellent <a href="http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html">SuperDuper!</a>. If you aren&#8217;t doing regular backups (daily), then you are asking for trouble. There are 2 kinds of computer users; those that have lost data and those that will.<br /><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2006/01/30/hard-drive-recovery-complete/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Hard drive failure</title><link>http://blog.gruby.com/2006/01/28/hard-drive-failure/</link> <comments>http://blog.gruby.com/2006/01/28/hard-drive-failure/#comments</comments> <pubDate>Sun, 29 Jan 2006 02:18:36 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Technology]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/2006/01/28/hard-drive-failure/</guid> <description><![CDATA[One of the worst things that could happen to a computer happened today to me. The hard drive on my PowerBook failed. It started making funny noises yesterday and then today it stopped spinning. Given that I&#8217;m a bit paranoid &#8230; <a href="http://blog.gruby.com/2006/01/28/hard-drive-failure/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>One of the worst things that could happen to a computer happened today to me. The hard drive on my PowerBook failed. It started making funny noises yesterday and then today it stopped spinning. Given that I&#8217;m a bit paranoid about backups, I said to myself, &#8220;this isn&#8217;t a problem as my backup is 2 hours old.&#8221; Then my elated thought turned to disappointment when I realized that my 2 hour old backup is sitting in the bank vault where I had just been a few hours earlier to store my backup. The good news is that my 9 day old backup boots my PowerBook thanks to <a href="http://www.shirt-pocket.com/SuperDuper/SuperDuperDescription.html">SuperDuper!</a>. So on Monday morning I&#8217;ll drive over to <a href="http://www.thechipmerchant.com/">The Chip Merchant</a>, plunk down $150 + tax for a new 80 GB hard drive, then goto the bank which doesn&#8217;t open until 9 am. Then I have the fun task of disassembling my PowerBook and putting the new hard drive in.</p><p>To add to my backup strategy, I&#8217;m going to get additional TrayDocks and have 2 backups at home so that this doesn&#8217;t happen again.<br /><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2006/01/28/hard-drive-failure/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Cocoa NSAutoreleasePool</title><link>http://blog.gruby.com/2006/01/26/cocoa-nsautoreleasepool/</link> <comments>http://blog.gruby.com/2006/01/26/cocoa-nsautoreleasepool/#comments</comments> <pubDate>Thu, 26 Jan 2006 21:06:07 +0000</pubDate> <dc:creator>Scott Gruby</dc:creator> <category><![CDATA[Programming]]></category> <category><![CDATA[Work]]></category><guid isPermaLink="false">http://blog.gruby.com/?p=1149</guid> <description><![CDATA[Autorelease pools are extremely convenient for not having to worry about memory allocation and freeing the allocated memory, similar to the Newton days with its garbage collection. A problem that I&#8217;ve been aware of with autorelease pools, but promptly forget &#8230; <a href="http://blog.gruby.com/2006/01/26/cocoa-nsautoreleasepool/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description> <content:encoded><![CDATA[<p>Autorelease pools are extremely convenient for not having to worry about memory allocation and freeing the allocated memory, similar to the Newton days with its garbage collection. A problem that I&#8217;ve been aware of with autorelease pools, but promptly forget all the time is that if you are in a tight loop and keep creating autoreleased items, you&#8217;re going to run out of memory and crash. For instance, in the following block of code, without even realizing it, a new autoreleased NSDate is being created once every tenth of a second. If you are processing data for say 3 minutes, you have created 1800 of these that aren&#8217;t being released.</p><pre>while (running)
{
	[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.10]];
}
</pre><p>Now that I&#8217;ve thought about this, 1800 doesn&#8217;t sound all that bad, however, if you keep doing this without giving the OS a chance to do the autorelease cleanup, you&#8217;ll run out of memory. A better way of doing this is:</p><pre>while (running)
{
	NSDate *newDate = [[NSDate alloc] initWithTimeIntervalSinceNow:0.10];
	[NSThread sleepUntilDate:newDate];
	[newDate release];
}
</pre><p>This way you won&#8217;t have anything lying around. Hopefully this will save a crash or two and lots of time scratching my head figuring out why it is crashing when I can&#8217;t reproduce the problem.<br /><hr/>Copyright &copy; 2012 <strong><a href="http://blog.gruby.com">Scott Gruby</a></strong>. The opinions expressed here do not necessarily reflect those of my employer. Please visit this site and use the Amazon link to support it.</p> ]]></content:encoded> <wfw:commentRss>http://blog.gruby.com/2006/01/26/cocoa-nsautoreleasepool/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Served from: blog.gruby.com @ 2012-02-04 21:12:00 by W3 Total Cache -->
