You would normally hear or read about compulsive behaviours and disorders being linked with Obsessive Compulsive Disorder (OCD), which is a diagnosis widely used within the mental health profession.
However, as a rule of thumb, a compulsive behaviour is one that is undertaken, often with little thought, on impulse or with a sense of having been ‘driven’ to it, and instant relief is felt. There may be some feelings of guilt or shame felt afterwards, but immediate gratification is felt at the time. For obsessive thoughts and behaviours, this sense of relief is often never achieved.
The person is likely to focus excessively on the issue at hand, often becoming totally preoccupied by it; they can find themselves involved in repetitive cycles of behaviour which provide little or no relief, and sometimes activities are carried out to ensure something else (often something bad) does not happen.