Locking up can mean a number of things, but for really bad cases it's just that.
It solves the problem of people out of their mind hurting others because they forget or just refuse to take their medication. And it's a better problem to solve than dealing with dead bodies.
You can still set as many controls as you deem reasonable, but sometimes families are put in impossible situations, just like in the article.