What causes Popping / Cracking joints?

What causes Popping / Cracking joints?

I have heard two explanations for this the first being that it is carbon dioxide being released from joints and connective tissue, hmm. The other which i belive to be far more likely is that the noise is caused buy the snapping of tendons over the bone and each other.

The reason i ask is that my back goes of like a fire cracker if i flex and stretch, not my spine but my upper back, in a similar way to how some one might crack there knuckles.