So I spent a few days trying to find a memory corruption bug, known as the infamous EXC_BAD_ACCESS. Basically that means that you are over-freeing zones of memory. In your GBD console, you will get some message like: *** malloc[705]: error for object 0×9c5b00: Incorrect checksum for freed object - object was probably modified after being freed; break at szone_error. Hmm. That really doesn’t tell us anything.The problem with malloc errors is that enabling zombies really doesn’t do anything, same with setting symbolic breakpoints in szone_error and malloc_error_break. So what’s the solution to finding this?Guard Malloc. Guard Malloc is a hard-to-find memory bug tracking utility that is part of libgmalloc.dylib. When you run with it enabled, for every malloc(), NSZoneMalloc(), or other associated memory allocators, Guard Malloc allocates its own virtual memory page, with the end of the allocated buffer at the end of the page. Therefore whenever you access outside of the buffer, it immediately causes a bus error. In addition, when memory is freed, libgmalloc deallocates its virtual memory buffer, so read and writes to the buffer also cause immediate bus errors. When running from Xcode with Guard Malloc, the Debugger will jump to the source where the bus error occurred making these bugs really easy to find.One issue with Guard Malloc is that because of all the paging, it takes a long time to do any operation. So be prepared to wait.Overall though, Guard Malloc is great and extremely helpful.
Archive for June, 2007
On Monday morning, Steve Jobs gave his keynote at the World Wide Developer’s Conference, most commonly known as WWDC. There is a common saying, at Apple at least, where we call this keynote the Stevenote. There are a few reasons why this event has been tagged as such. First off, what is always included in the Stevenote is flashy stuff. The fluff of software is what Steve Jobs loves to show off. In the hallways of the Apple Campus, you hear engineers talk about how they spent one hour adding some flashy animation to an interface or changed the look of a button just so that Steve would like it, and want to show it at his keynote. The second characteristic of the Stevenote is that he always shows off something secret that no one else, except the engineers who worked on it, know about. And finally, the Stevenote is usually really good, and has you leaving the room excited and ready to go innovate.I regret to say that this year’s WWDC keynote may have hinted on the first two, but certainly fell short of the third one. The keynote was indeed flashy, as Steve demoed the latest features of the Mac OS called Leopard. The announcement of Safari on Windows was certainly surprising. But after the hour and half, I was bored, and ready for it to be done. Here are the things I liked and didn’t like about Steve Jobs keynote.
- The new desktop?: One extremely misleading feature of Leopard is the “new” desktop. OK, maybe in terms of code a lot of new things are happening, but it was hardly worth the number one feature. There is a new silver dock, which I like, a deeper drop shadow on the active window, which I like, a unified UI, which I like, but the new menu bar? I loathe the new menu bar. It supposed to adapt to your background picture, but it ends up just totally being unreadable. In earlier versions of Leopard, they had a great menu bar, and two or three days we sent off Leopard to be duplicated for the developers, they changed it. And everyone hated it, and they ignored us. Now everyone at Apple and everyone at WWDC hates it.
- Spaces: I actually love Spaces. There are a lot of people who don’t, but I do. It is an extremely useful way of getting rid of windows that you don’t want to see at the current time. It’s like having as many monitors as you want, only you don’t have to strain your neck to look at them. It’s just a keystroke, and your there. Great! There are currently two other ways to hide windows: minimize them or hide the entire application. Personally, I think minimizing windows is one of the dumbest ideas ever. Maybe that is one of the reasons why I hate Windows so much is because they hinge on that. I don’t want my window to go somewhere where I have to bring my mouse down and retrieve it. No. I want a keystroke to get it back. Hiding the entire application is a good start, because it can be done with a keystroke and retrieved with a keystroke, and it does not clutter up my Dock or anything. Of course, if I need these windows open so I can do a copy and then paste or drag and drop, the screen gets cluttered. Spaces opens up a lot of space, and its sweet.
- CoverFlow in the Finder: I was watching the keynote in one of the employee rooms, and when Steve Jobs said that CoverFlow in the Finder was useful, our whole room burst in laughter. That’s because we had been trying to use it for the past month (for me) or months (for everyone else), and we could not find any use for it. Again, to be perfectly honest, I just don’t like the finder. I am perfectly content with
cd,ls,cp, andmv. - Dashboard: When Steve Jobs needs five minutes to show off a movie widget, you know that he has absolutely nothing better to say. Dashboard is a memory sucking camel, and extremely over-hyped. Yeah, WebClip is cool. But I still do not think that he had to spend so much time on a Javascript widget that most developers could have written quite easily
- Safari on Windows: This is a great strategy. Combined with the release of the iPhone, I think that lots of people, mainly iPhone developers, will use Safari in order to test their sites. I don’t mind Apple products on the Windows platform, especially when they run faster than their competitors.
- A “sweet” way to make iPhone applications: Here at Apple, we have created a sweet way to create applications on the iPhone, they are called websites. Come on! Are we stupid? I do not think that dwelling on this sweet way of making applications was necessary or beneficial. I think anyone who has written a line of HTML would be offended by that. I know a lot of people who were.
So I have been pretty harsh on Apple, but I think we should. Apple is the leader of innovation, and they have extremely high standards around the globe. I think that the display that Steve Jobs put on was not on par with where it should be. I am looking forward to how Steve is going to dig himself out of this one.
Check out the Photos section to see pictures from Page Mill Road and also my last trip to San Francisco.
I think at this point a lot of people are probably wondering: “Why is Kevin’s blog so boring.” Well, I will give you an honest answer: my life outside of work is not too exciting. I would love to tell you about work, but then I would have to kill you. So, I will tell you what I can about my typical day.7:20: Good morningIt’s usually up pretty early, about 7:20, which means I don’t get out of bed until 7:30. Then I do the typical morning get ready deal to prepare myself for the day.7:40: DevosI can’t start my day without some time in the Word. Right now I am reading Jeremiah, after just completing a cover-to-cover reading of the entire Bible (which I would recommend to everyone, even if you don’t believe what it says). Devos also encompasses some time reading a devotional by Frederick Buechner called “Listening to Your Life.” I would say that it certainly has its gems.8:15: BreakfastBy now my roommates Dax Norman and Matt Pizzimenti are up, so we will eat breakfast together. I am a big fan of Fruit Loops cereal. Hey, it’s better than pop-tarts!8:30: Off to workI like getting out the door relatively early. The Apple Campus really doesn’t start until 11, so I have about 2 hours of solid quiet time to work on my projects. The walk to work only takes 5 minutes, but it is 5 minutes along a busy road and over a major highway, not the most serene walk. When I get to work, I usually will set up my workstation by wiring in my laptop to my iMac, read some emails, get some ice tea, and then get on with the work for the day.8:45 - 12:30: WorkAs with most people, I do work best in the morning. So I work hard until lunch. There’s not much else I can say here, except that I love what I do. For those of you who still don’t know exactly what I do, don’t fret, no one does. But I can tell you that I work on the Interface Builder Team for the Runtime Technologies Group, which is part of the Developer Technologies Department. I work with some great people, and the floor seems to glow with bright people.12:30 - 1:30: Lunch at Caffe MacsCaffe Macs is the place to go for lunch, and pretty much everyone ends up there between 11 and 2. They have quite the variety of food: a burrito bar, salad bar, sandwich bar, grill, Sushi bar, Asian salad bar, cooked pasta goods, pizza bar, gelato and dessert bar, and of course all of the other fruit and vegetable and bread tables. Great food, and very reasonably priced. Yeah so it’s not Google, but its still good food that I haven’t gotten sick of eating yet.1:30 - 6:00: Work time!As with the morning, this is just more work. By the now most of the office has woken up, so there is the steady hum of people milling about and asking question and running into bugs.6:00: Dinner or home, dependingBecause we are closing in on the conference (WWDC), there is a lot of work still to be done. So, a lot of people stay to do work all night. In fact, most engineers are on the noon to midnight work flow, or lunch to 3 in the morning work flow. So usually our whole department will go down to Caffe Macs where we get served dinner for free because we are working so hard for the conference.7:00 - 8:00: HomeI hardly ever stay past 7 or 8. I like to have a little time back at the apartment to read, relax, code, and organize photos. Other books I am reading right now are: Code Complete by Steve McConnell, and Mere Christianity by C.S. Lewis. I am still working hard on MacQuill, as I move closer to a beta release sometime soon.10:30: BedI don’t stay up late. By this time I am wiped, and I need to go to bed to get up and do it all over again in the morning.So is that still boring you?