Food can function like a drug. Some people are afraid of what will happen if they do not suppress their feelings with food. As tiredness increases, the sensible and thoughtful part of the personality doesn't function so well and an irresistible urge to eat takes over.
It is only through understanding yourself that you can find better solutions. If you know that you eat when you are tired, you can take a short rest in the middle of the day. If you know that you eat when you are lonely at home, you can make sure that you don't have any attractive junk food there. Compulsive eaters have their eating, alcoholics have their drinking, they function in the same way: the immature parts of their mind wait for a chance to take over when the mature part of the personality is exhausted.
It is important to understand this, so that the mature part of yourself can find sensible solutions and arrange your life so that the lust for junk food never gets a chance to take over.
Those with eating disorders use a faulty method of solving their problems. They flee from them instead of dealing with them finding constructive solutions.
Eating becomes a substitute for the real need, which may be friends and companionship. Without compulsive eating there is initially a feeling of even more loneliness. However, this unbearable feeling leads a person to find some friends or contact existing friends. That is to manage the problem in an adequate way.