To one of my very nervous patients, who was an abstainer, whose fancy was fixed on his mother, and who repeatedly dreamed of climbing stairs accompanied by his mother, I once remarked that moderate masturbation would be less harmful to him than enforced abstinence.
Source: wiktionary