An EXC_BAD_ACCESS error comes only after my app reads my custom
format type of data and reads document nib file.
Bad Access means that you're trying to access an invalid pointer,
which is usually due to either a pointer variable that wasn't
initialized correctly, or accessing a pointer that has been disposed
of already. Often this happens because someone who doesn't own a
particular object called release or autorelease on it, or because you
forgot to retain an object that you're keeping around in an instance
variable.
I wrote an article a while ago about memory management and how it
works. That may help a bit, because I spent a lot of time drawing
pictures that show memory in a nice visual fashion:
It starts with the bare basics you probably already know, but if you
just plow on, it should explain things more thoroughly. The article
isn't really specific to Cocoa, so if you want the whole story with
explanations specific to Cocoa, you'll want to listen through Steve
"Scotty" Scott's memory management podcast: