This probably originates from Harlan Ellison's short story (found in the collection of the same title), "I Have No Mouth and I Must Scream" (first published in IF: Worlds of Fiction, March 1967). In this story, a small group of humans are captives of a malevolent "world computer" AI, kept underground and not permitted to die, never mind any other freedoms; they do what the computer says, go where they're told to go.
In a climactic scene, while they're being tortured with icy tunnels, one of them manages to break off a large icicle and stab another with it, then impale herself (I could be remembering this not quite right, but it's the right general plotline), and the narrator character picks up on it and does the same to the one remaining person -- but then can't manage to do himself in before the computer manages to stop him.
The closing part of the story bemoans his fate as the last remaining human, kept away from anything that might possibly be used as a weapon and tortured even more intensely, and "I have no mouth, and I must scream!" is the closing line.