When someone is getting less concentrated, confused, or committing mistakes all the time then he is losing his marbels. It is related to the mental status of this person. It does not mean he is metally ill though.
I can not pass this exam. It seems I am losing my marbels
Stop thinking of her, you are losing your marbels
If I stayed unemployed any longer, I will lose my marbels
Boys who enjoy yaoi (a genre in Japan that contains sexual and/or romantic relations between two men); literally translates to "rotten boy"; corresponding female : fujoshi