Like murder, suicide is also taboo. The traditional Catholic way of thinking condemns those who have committed suicide, saying that it will automatically send them to hell without any chance of salvation. However, more recent Catholic ways of thinking state that one shouldn't condemn suicide victims but should be prayed for. Indeed, that is a better thing to do than flat-out damnation but still, I'm not really a fan of prayer.
Most people commit suicide due to mental instability and thus, have lost control of their rational minds. Others who do it with a rational mind, however, have stronger feelings than just being unwanted and unloved. Take for instance the Japanese soldiers who commit the honorable seppuku or the atrocious kamikaze. Muslim terrorists also commit suicide with bombs and take the lives of others with them in the name of their god. That being said, people usually think "Is there really no way for an act of suicide to be moral and just?" In fact, there are.
Picture this scenario: Two hikers were walking on a rope bridge when the bridge suddenly snapped. Hiker A was luckily able to hang on to Hiker B's leg but the latter was not strong enough to pull them both up and both of them will eventually fall. Hiker A decided to let go because he thought that it would be better if at least one of them had lived.
Suicide that leads to a better good is just. Anything that leads to a greater good is always just. The end doesn't always justifty the means, but in cases like heroic suicide, it does.