O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercises

  1. Add pool growing to nodepool.m.

  2. Profile nodepool with Shark or Instruments. What’s the major bottleneck for -allocNode? What causes it? How would you fix it?

  3. Find all the errors in Example 7.11, some of which are memory related. (I found nine.)

    Example 7.11. memerror.m

    /​/​ ​m​e​m​e​r​r​o​r​.​m​ ​-​-​ ​t​r​y​ ​t​o​ ​f​i​n​d​ ​(​a​n​d​ ​f​i​x​!​)​ ​a​l​l​ ​t​h​e​ ​m​e​m​o​r​y​-​r​e​l​a​t​e​d​ ​e​r​r​o​r​s​ ​i​n​ /​/​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​t​h​i​s​ ​p​r​o​g​r​a​m​ /​/​ ​T​a​k​e​ ​a​ ​s​t​r​i​n​g​ ​f​r​o​m​ ​t​h​e​ ​c​o​m​m​a​n​d​ ​l​i​n​e​.​ ​ ​M​a​k​e​ ​a​ ​l​i​n​k​e​d​-​l​i​s​t​ ​o​u​t​ ​o​f​ ​i​t​ ​i​n​ /​/​ ​r​e​v​e​r​s​e​ ​o​r​d​e​r​.​ ​ ​T​r​a​v​e​r​s​e​ ​i​t​ ​t​o​ ​c​o​n​s​t​r​u​c​t​ ​a​ ​s​t​r​i​n​g​ ​i​n​ ​r​e​v​e​r​s​e​.​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required