[pbn@ibook] /Users/pbn> gcc -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk hello.cAnd you see the result is a fat binary:
[pbn@ibook] /Users/pbn> file a.out a.out: Mach-O fat file with 2 architectures a.out (for architecture i386): Mach-O executable i386 a.out (for architecture ppc): Mach-O executable ppc
[pbn@ibook] /Users/pbn> heap 144To find the PID of a process, type for instance:
[pbn@ibook] /Users/pbn> ps uxor
[pbn@ibook] /Users/pbn> ps auxYou can also call the heap command by giving it the name of process. For instance, let's look at the heap of the well-known process, the Dock:
[pbn@ibook] /Users/pbn> heap Dock Process 142: 1 zone Zone DefaultMallocZone_0x300000: Overall size: 9352KB; 5303 nodes malloced for 554KB (5% of capacity); largest unused: [0x01839e00-7992KB] Zone DefaultMallocZone_0x300000: 5303 nodes - Sizes: 24KB[1] 20KB[2] 16KB[1] 11KB[1] 8KB[2] 5KB[1] 5KB[1] 4KB[11] 3072[5] 2560[9] 2048[6] 1536[14] 1024[48] 512[11] 480[4] 464[2] 448[5] 432[4] 400[2] 384[1] 352[2] 336[6] 320[4] 304[2] 288[13] 272[17] 256[12] 240[196] 224[24] 208[14] 192[38] 176[21] 160[7] 144[46] 128[47] 112[58] 96[190] 80[221] 64[212] 48[1137] 32[837] 16[2068] Found 510 ObjC classes in process 142 ----------------------------------------------------------------------- Zone DefaultMallocZone_0x300000: 5303 nodes (566912 bytes) CLASS_NAME COUNT BYTES AVG ========== ===== ===== === <non-object> 2171 404016 186.1 NSCFNumber 1213 19408 16.0 NSCFString 721 27072 37.5 NSCFDictionary 630 85824 136.2 NSCFType 243 17296 71.2 NSCFArray 162 4896 30.2 NSURL 62 1984 32.0 NSCFSet 35 1696 48.5 NSMachPort 27 1728 64.0 NSCFData 25 2544 101.8 NSCFAttributedString 10 160 16.0 NSCFTimer 2 160 80.0 NSNotificationCenter 1 64 64.0 NSThread 1 64 64.0You'll notice all classes start with NS. NS means NextStep.
But, how exactly do you write NextStep ?
Well, even the NextStep developers didn't agree about this... It can be written NextStep, NeXTstep, NeXTStep, NeXTSTEP, or NEXTSTEP. You saw in the above example that the heap command give us hints about NextStep. But, there are traces of NextStep elsewhere in Mac OS X. Let us look at the man pages for two commands, open and defaults:
If you type:
[pbn@ibook] /Users/pbn> man open... you can see:
HISTORY First appeared in NextStep.
[pbn@ibook] /Users/pbn> man defaults... you can see:
HISTORY First appeared in NeXTStep.
"tellmeafortune.pl" is a script written in Perl and AppleScript. It will pick a random fortune and tell it using Mac OS X's speech synthesizer. Click here to download it. |
Running Mac OS X Tiger
If you are ready to dig deep into your Mac, this book expertly guides you to the core of Mac OS X. It helps you understand the inner workings of the operating system so you can know how to get the most out of it. And it gives you countless ideas--and step-by-step instruction--for customizing and revving up Tiger to your specific needs and your liking.
|
Learning Unix for Mac OS X Tiger
If you're a Mac OS X user and you don't know much about Unix then this book is for you. You will start using the Terminal.App in Mac OS X and slowly discover the power of Unix.
|
Mac OS X Tiger for Unix Geeks
Welcome to the next level ! If you've read and understood the previous book, you can now jump to this one. You'll learn about Unix on Mac OS X. This book is recommended for anyone switching from
Unix,
Linux,
FreeBSD,
NetBSD,
OpenBSD or
DragonFlyBSD
to Mac OS X.
|