It means that you couldn't remember his name although you were trying very hard. LS
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
MrPedanticWell, on reflection, you could also use it as a fragment, e.g.
1. "So can you guess what this does?" "Not for the life of me, no."
And it doesn't need to introduce a clause, e.g.
2. I can't for the life of me remember his name.
Really, the structure is just:
3. I can't/couldn't (for the life of me) do X.
(So