How much time do you invest in improving a relationship before you give up?

If there are issues in your relationship and you both are working on improving it...how much time to invest before you considered it a loss? If your partner has spending issues, alcohol issues, sexual issues, lying etc.  Do you wait 6 months, 1 year, 2 years or forever?