See if this article helps you get a grip on the behavior (pun intended). http://www.malesurvivor.org/articles/singer2.htm
In all seriousness, from what you describe, the behavior is one that no longer has a legitimate function but serves only to numb you out from your feelings. The end result is keeping you in a cycle of self-defeating behaviors, from what it sounds like.
The more you feel bad about this, the greater the self-loathing and greater likelihood of repeating what temporarily feels good but leaves you unempowered.
Hope this helps.