There's an idiom "work one's fingers to the bone" literally linked to manual labor, and I am looking for the like colloquial, idiomatic or slang expression referring to hard mental work. The one that I'm familiar with, rack one's brain, doesn't seem to quite fit my request. Although it does mean to think long and hard to recall or think of something, it does not reflect the almost total mental exhaustion as compared to the fingers' skin and flash worn out and torn by the hard manual work. Could anyone kindly suggest anything corresponding to what I'm looking for?
One word used is burnout:
Physical or mental collapse caused by overwork or stress.
It can also be used as a verb (written as two words). If you're in the middle of the process you'd say you're burning yourself out.
I have only ever heard this to refer to mental work, such as programming. You can browse the burnout tag on The Workplace to see some examples.