Must be some nagging injury, but there can be many reasons for that. Ideally, I would pay a visit to a manual therapist, who can determine the exact reason fro this cracking, and suggest the solutions accordingly. It is always best to be aware of what is actually happening - our joints don't crank or hurt without any reason.