to think very hard, usually in order to remember something or to find a solution to a problem.
I've been racking my brains but I still can't remember who wrote that play.
rack (one's) brain(s)
To struggle to recall or think of something. I've been racking my brain, but I still can't remember what Lydia's husband's name is.He racked his brains all weekend trying to think of a solution to the problem.